1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-24 00:01:11 +01:00
actix-net/actix_service/trait.ServiceExt.html
2024-10-01 00:01:00 +00:00

40 lines
11 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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="An extension trait for `Service`s that provides a variety of convenient adapters."><title>ServiceExt in actix_service - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-46f98efaafac5295.ttf.woff2,FiraSans-Regular-018c141bf0843ffd.woff2,FiraSans-Medium-8f9a781e4970d388.woff2,SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2,SourceCodePro-Semibold-d899c5a5c4aeb14a.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-76eba96aa4d2e634.css"><link rel="stylesheet" href="../static.files/rustdoc-b778ab399e080a4b.css"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="actix_service" data-themes="" data-resource-suffix="" data-rustdoc-version="1.83.0-nightly (7608018cb 2024-09-29)" data-channel="nightly" data-search-js="search-e056c65ede92db13.js" data-settings-js="settings-805db61a62df4bd2.js" ><script src="../static.files/storage-1d39b6787ed640ff.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-54bc299d2a5e4e43.js"></script><noscript><link rel="stylesheet" href="../static.files/noscript-0111fcff984fae8f.css"></noscript><link rel="icon" href="https://actix.rs/favicon.ico"></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><a class="logo-container" href="../actix_service/index.html"><img src="https://actix.rs/img/logo.png" alt=""></a></nav><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../actix_service/index.html"><img src="https://actix.rs/img/logo.png" alt="logo"></a><h2><a href="../actix_service/index.html">actix_<wbr>service</a><span class="version">2.0.2</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Service<wbr>Ext</a></h2><h3><a href="#provided-methods">Provided Methods</a></h3><ul class="block"><li><a href="#method.and_then" title="and_then">and_then</a></li><li><a href="#method.map" title="map">map</a></li><li><a href="#method.map_err" title="map_err">map_err</a></li></ul><h3><a href="#implementors">Implementors</a></h3></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="index.html">In crate actix_<wbr>service</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">actix_service</a></span><h1>Trait <span class="trait">ServiceExt</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/actix_service/ext.rs.html#10-59">source</a> </span></div><pre class="rust item-decl"><code>pub trait ServiceExt&lt;Req&gt;: <a class="trait" href="trait.Service.html" title="trait actix_service::Service">Service</a>&lt;Req&gt; {
// Provided methods
fn <a href="#method.map" class="fn">map</a>&lt;F, R&gt;(self, f: F) -&gt; Map&lt;Self, F, Req, R&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type actix_service::Service::Response">Response</a>) -&gt; R</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.map_err" class="fn">map_err</a>&lt;F, E&gt;(self, f: F) -&gt; MapErr&lt;Self, Req, F, E&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(Self::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type actix_service::Service::Error">Error</a>) -&gt; E</span> { ... }
<span class="item-spacer"></span> fn <a href="#method.and_then" class="fn">and_then</a>&lt;I, S1&gt;(self, service: I) -&gt; AndThenService&lt;Self, S1, Req&gt;
<span class="where">where Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
I: <a class="trait" href="trait.IntoService.html" title="trait actix_service::IntoService">IntoService</a>&lt;S1, Self::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type actix_service::Service::Response">Response</a>&gt;,
S1: <a class="trait" href="trait.Service.html" title="trait actix_service::Service">Service</a>&lt;Self::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type actix_service::Service::Response">Response</a>, Error = Self::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type actix_service::Service::Error">Error</a>&gt;</span> { ... }
}</code></pre><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>An extension trait for <a href="trait.Service.html" title="trait actix_service::Service"><code>Service</code></a>s that provides a variety of convenient adapters.</p>
</div></details><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.map" class="method"><a class="src rightside" href="../src/actix_service/ext.rs.html#20-26">source</a><h4 class="code-header">fn <a href="#method.map" class="fn">map</a>&lt;F, R&gt;(self, f: F) -&gt; Map&lt;Self, F, Req, R&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(Self::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type actix_service::Service::Response">Response</a>) -&gt; R,</div></h4></section></summary><div class="docblock"><p>Map this services output to a different type, returning a new service
of the resulting type.</p>
<p>This function is similar to the <code>Option::map</code> or <code>Iterator::map</code> where
it will change the type of the underlying service.</p>
<p>Note that this function consumes the receiving service and returns a
wrapped version of it, similar to the existing <code>map</code> methods in the
standard library.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.map_err" class="method"><a class="src rightside" href="../src/actix_service/ext.rs.html#36-42">source</a><h4 class="code-header">fn <a href="#method.map_err" class="fn">map_err</a>&lt;F, E&gt;(self, f: F) -&gt; MapErr&lt;Self, Req, F, E&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
F: <a class="trait" href="https://doc.rust-lang.org/nightly/core/ops/function/trait.Fn.html" title="trait core::ops::function::Fn">Fn</a>(Self::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type actix_service::Service::Error">Error</a>) -&gt; E,</div></h4></section></summary><div class="docblock"><p>Map this services error to a different error, returning a new service.</p>
<p>This function is similar to the <code>Result::map_err</code> where it will change
the error type of the underlying service. For example, this can be useful to
ensure that services have the same error type.</p>
<p>Note that this function consumes the receiving service and returns a
wrapped version of it.</p>
</div></details><details class="toggle method-toggle" open><summary><section id="method.and_then" class="method"><a class="src rightside" href="../src/actix_service/ext.rs.html#51-58">source</a><h4 class="code-header">fn <a href="#method.and_then" class="fn">and_then</a>&lt;I, S1&gt;(self, service: I) -&gt; AndThenService&lt;Self, S1, Req&gt;<div class="where">where
Self: <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,
I: <a class="trait" href="trait.IntoService.html" title="trait actix_service::IntoService">IntoService</a>&lt;S1, Self::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type actix_service::Service::Response">Response</a>&gt;,
S1: <a class="trait" href="trait.Service.html" title="trait actix_service::Service">Service</a>&lt;Self::<a class="associatedtype" href="trait.Service.html#associatedtype.Response" title="type actix_service::Service::Response">Response</a>, Error = Self::<a class="associatedtype" href="trait.Service.html#associatedtype.Error" title="type actix_service::Service::Error">Error</a>&gt;,</div></h4></section></summary><div class="docblock"><p>Call another service after call to this one has resolved successfully.</p>
<p>This function can be used to chain two services together and ensure that the second service
isnt called until call to the first service have finished. Result of the call to the first
service is used as an input parameter for the second services call.</p>
<p>Note that this function consumes the receiving service and returns a wrapped version of it.</p>
</div></details></div><h2 id="implementors" class="section-header">Implementors<a href="#implementors" class="anchor">§</a></h2><div id="implementors-list"><section id="impl-ServiceExt%3CReq%3E-for-S" class="impl"><a class="src rightside" href="../src/actix_service/ext.rs.html#61">source</a><a href="#impl-ServiceExt%3CReq%3E-for-S" class="anchor">§</a><h3 class="code-header">impl&lt;S, Req&gt; <a class="trait" href="trait.ServiceExt.html" title="trait actix_service::ServiceExt">ServiceExt</a>&lt;Req&gt; for S<div class="where">where
S: <a class="trait" href="trait.Service.html" title="trait actix_service::Service">Service</a>&lt;Req&gt;,</div></h3></section></div><script src="../trait.impl/actix_service/ext/trait.ServiceExt.js" async></script></section></div></main></body></html>