30 lines
11 KiB
HTML
30 lines
11 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="`Bifunctor`, but specialized to know at compile-time that the functions will only be called at most once."><title>BifunctorOnce in naan::bifunctor - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2" crossorigin href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-42caa33d.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="naan" data-themes="" data-resource-suffix="" data-rustdoc-version="1.84.0 (9fc6b4312 2025-01-07)" data-channel="1.84.0" data-search-js="search-92e6798f.js" data-settings-js="settings-0f613d39.js" ><script src="../../static.files/storage-59e33391.js"></script><script defer src="sidebar-items.js"></script><script defer src="../../static.files/main-5f194d8c.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-893ab5e7.css"></noscript><link rel="alternate icon" type="image/png" href="../../static.files/favicon-32x32-6580c154.png"><link rel="icon" type="image/svg+xml" href="../../static.files/favicon-044be391.svg"></head><body class="rustdoc trait"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle" title="show sidebar"></button></nav><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../naan/index.html">naan</a><span class="version">0.1.32</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Bifunctor<wbr>Once</a></h2><h3><a href="#required-methods">Required Methods</a></h3><ul class="block"><li><a href="#tymethod.bimap1" title="bimap1">bimap1</a></li></ul><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.lmap1" title="lmap1">lmap1</a></li><li><a href="#method.rmap1" title="rmap1">rmap1</a></li></ul><h3><a href="#foreign-impls">Implementations on Foreign Types</a></h3><ul class="block"><li><a href="#impl-BifunctorOnce%3CResult,+A,+E%3E-for-Result%3CA,+E%3E" title="Result<A, E>">Result<A, E></a></li></ul><h3><a href="#dyn-compatibility">Dyn Compatibility</a></h3><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2><a href="index.html">In naan::<wbr>bifunctor</a></h2></div></div></nav><div class="sidebar-resizer"></div><main><div class="width-limiter"><rustdoc-search></rustdoc-search><section id="main-content" class="content"><div class="main-heading"><span class="rustdoc-breadcrumbs"><a href="../index.html">naan</a>::<wbr><a href="index.html">bifunctor</a></span><h1>Trait <span class="trait">BifunctorOnce</span><button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/naan/bifunctor.rs.html#7-34">Source</a> </span></div><pre class="rust item-decl"><code>pub trait BifunctorOnce<F, A, B><div class="where">where
|
|
F: <a class="trait" href="../trait.HKT2.html" title="trait naan::HKT2">HKT2</a><T<A, B> = Self>,</div>{
|
|
// Required method
|
|
fn <a href="#tymethod.bimap1" class="fn">bimap1</a><A2, B2, FA, FB>(self, fa: FA, fb: FB) -> F::<a class="associatedtype" href="../trait.HKT2.html#associatedtype.T" title="type naan::HKT2::T">T</a><A2, B2>
|
|
<span class="where">where FA: <a class="trait" href="../fun/trait.F1Once.html" title="trait naan::fun::F1Once">F1Once</a><A, Ret = A2>,
|
|
FB: <a class="trait" href="../fun/trait.F1Once.html" title="trait naan::fun::F1Once">F1Once</a><B, Ret = B2></span>;
|
|
|
|
// Provided methods
|
|
fn <a href="#method.lmap1" class="fn">lmap1</a><A2, FA>(self, fa: FA) -> F::<a class="associatedtype" href="../trait.HKT2.html#associatedtype.T" title="type naan::HKT2::T">T</a><A2, B>
|
|
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
|
FA: <a class="trait" href="../fun/trait.F1Once.html" title="trait naan::fun::F1Once">F1Once</a><A, Ret = A2></span> { ... }
|
|
<span class="item-spacer"></span> fn <a href="#method.rmap1" class="fn">rmap1</a><B2, FB>(self, fb: FB) -> F::<a class="associatedtype" href="../trait.HKT2.html#associatedtype.T" title="type naan::HKT2::T">T</a><A, B2>
|
|
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
|
FB: <a class="trait" href="../fun/trait.F1Once.html" title="trait naan::fun::F1Once">F1Once</a><B, Ret = B2></span> { ... }
|
|
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p><a href="trait.Bifunctor.html" title="trait naan::bifunctor::Bifunctor"><code>Bifunctor</code></a>, but specialized to know at compile-time
|
|
that the functions will only be called at most once.</p>
|
|
</div></details><h2 id="required-methods" class="section-header">Required Methods<a href="#required-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="tymethod.bimap1" class="method"><a class="src rightside" href="../../src/naan/bifunctor.rs.html#11-13">Source</a><h4 class="code-header">fn <a href="#tymethod.bimap1" class="fn">bimap1</a><A2, B2, FA, FB>(self, fa: FA, fb: FB) -> F::<a class="associatedtype" href="../trait.HKT2.html#associatedtype.T" title="type naan::HKT2::T">T</a><A2, B2><div class="where">where
|
|
FA: <a class="trait" href="../fun/trait.F1Once.html" title="trait naan::fun::F1Once">F1Once</a><A, Ret = A2>,
|
|
FB: <a class="trait" href="../fun/trait.F1Once.html" title="trait naan::fun::F1Once">F1Once</a><B, Ret = B2>,</div></h4></section></summary><div class="docblock"><p>See <a href="trait.Bifunctor.html" title="trait naan::bifunctor::Bifunctor"><code>Bifunctor</code></a></p>
|
|
</div></details></div><h2 id="provided-methods" class="section-header">Provided Methods<a href="#provided-methods" class="anchor">§</a></h2><div class="methods"><details class="toggle method-toggle" open><summary><section id="method.lmap1" class="method"><a class="src rightside" href="../../src/naan/bifunctor.rs.html#18-23">Source</a><h4 class="code-header">fn <a href="#method.lmap1" class="fn">lmap1</a><A2, FA>(self, fa: FA) -> F::<a class="associatedtype" href="../trait.HKT2.html#associatedtype.T" title="type naan::HKT2::T">T</a><A2, B><div class="where">where
|
|
Self: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
|
FA: <a class="trait" href="../fun/trait.F1Once.html" title="trait naan::fun::F1Once">F1Once</a><A, Ret = A2>,</div></h4></section></summary><div class="docblock"><p>Map the left type in the Bifunctor</p>
|
|
<p>In Result, this maps the “Ok” type and is equivalent to <code>map</code>.</p>
|
|
</div></details><details class="toggle method-toggle" open><summary><section id="method.rmap1" class="method"><a class="src rightside" href="../../src/naan/bifunctor.rs.html#28-33">Source</a><h4 class="code-header">fn <a href="#method.rmap1" class="fn">rmap1</a><B2, FB>(self, fb: FB) -> F::<a class="associatedtype" href="../trait.HKT2.html#associatedtype.T" title="type naan::HKT2::T">T</a><A, B2><div class="where">where
|
|
Self: <a class="trait" href="https://doc.rust-lang.org/1.84.0/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
|
|
FB: <a class="trait" href="../fun/trait.F1Once.html" title="trait naan::fun::F1Once">F1Once</a><B, Ret = B2>,</div></h4></section></summary><div class="docblock"><p>Map the right type in the Bifunctor</p>
|
|
<p>In Result, this maps the “Error” type and is equivalent to <code>map_err</code>.</p>
|
|
</div></details></div><h2 id="dyn-compatibility" class="section-header">Dyn Compatibility<a href="#dyn-compatibility" class="anchor">§</a></h2><div class="dyn-compatibility-info"><p>This trait is <b>not</b> <a href="https://doc.rust-lang.org/1.84.0/reference/items/traits.html#object-safety">dyn compatible</a>.</p><p><i>In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.</i></p></div><h2 id="foreign-impls" class="section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor">§</a></h2><details class="toggle implementors-toggle"><summary><section id="impl-BifunctorOnce%3CResult,+A,+E%3E-for-Result%3CA,+E%3E" class="impl"><a class="src rightside" href="../../src/naan/impls/result.rs.html#191-201">Source</a><a href="#impl-BifunctorOnce%3CResult,+A,+E%3E-for-Result%3CA,+E%3E" class="anchor">§</a><h3 class="code-header">impl<A, E> <a class="trait" href="trait.BifunctorOnce.html" title="trait naan::bifunctor::BifunctorOnce">BifunctorOnce</a><<a class="struct" href="../impls/result/hkt/struct.Result.html" title="struct naan::impls::result::hkt::Result">Result</a>, A, E> for <a class="enum" href="https://doc.rust-lang.org/1.84.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a><A, E></h3></section></summary><div class="impl-items"><section id="method.bimap1" class="method trait-impl"><a class="src rightside" href="../../src/naan/impls/result.rs.html#192-200">Source</a><a href="#method.bimap1" class="anchor">§</a><h4 class="code-header">fn <a href="#tymethod.bimap1" class="fn">bimap1</a><AB, BB, FA, FB>(self, fa: FA, fb: FB) -> <<a class="struct" href="../impls/result/hkt/struct.Result.html" title="struct naan::impls::result::hkt::Result">Result</a> as <a class="trait" href="../trait.HKT2.html" title="trait naan::HKT2">HKT2</a>>::<a class="associatedtype" href="../trait.HKT2.html#associatedtype.T" title="type naan::HKT2::T">T</a><AB, BB><div class="where">where
|
|
FA: <a class="trait" href="../fun/trait.F1Once.html" title="trait naan::fun::F1Once">F1Once</a><A, Ret = AB>,
|
|
FB: <a class="trait" href="../fun/trait.F1Once.html" title="trait naan::fun::F1Once">F1Once</a><E, Ret = BB>,</div></h4></section></div></details><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"></div><script src="../../trait.impl/naan/bifunctor/trait.BifunctorOnce.js" data-ignore-extern-crates="core" async></script></section></div></main></body></html> |