Struct qiniu_http_client::Endpoints
source · pub struct Endpoints { /* private fields */ }
Expand description
终端地址列表
存储一个七牛服务的多个终端地址,包含主要地址列表和备选地址列表
Implementations§
source§impl Endpoints
impl Endpoints
sourcepub fn builder(endpoint: Endpoint) -> EndpointsBuilder
pub fn builder(endpoint: Endpoint) -> EndpointsBuilder
创建终端地址列表构建器
必须提供一个主要终端地址
Examples found in repository?
More examples
src/regions/endpoints_provider/endpoints.rs (line 43)
42 43 44 45 46 47 48 49 50 51 52 53 54 55
static DEFAULT_UC_ENDPOINTS: Lazy<Endpoints> = Lazy::new(|| {
Endpoints::builder(Endpoint::new_from_domain("uc.qbox.me"))
.add_preferred_endpoint(Endpoint::new_from_domain("kodo-config.qiniuapi.com"))
.add_preferred_endpoint(Endpoint::new_from_domain("api.qiniu.com"))
.build()
});
&DEFAULT_UC_ENDPOINTS
}
/// 创建只包含一个主要终端地址的终端地址列表
#[inline]
pub fn new(endpoint: Endpoint) -> Self {
Self::builder(endpoint).build()
}
sourcepub fn preferred(&self) -> &[Endpoint]
pub fn preferred(&self) -> &[Endpoint]
返回主要终端地址列表
Examples found in repository?
src/regions/region.rs (line 63)
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160
pub fn up_preferred_endpoints(&self) -> &[Endpoint] {
self.up().preferred()
}
/// 获取上传服务备选终端列表
///
/// 与 `up().alternative()` 等效
#[inline]
pub fn up_alternative_endpoints(&self) -> &[Endpoint] {
self.up().alternative()
}
/// 获取下载服务主要终端列表
///
/// 与 `io().preferred()` 等效
#[inline]
pub fn io_preferred_endpoints(&self) -> &[Endpoint] {
self.io().preferred()
}
/// 获取下载服务备选终端列表
///
/// 与 `io().alternative()` 等效
#[inline]
pub fn io_alternative_endpoints(&self) -> &[Endpoint] {
self.io().alternative()
}
/// 获取存储空间管理服务主要终端列表
///
/// 与 `uc().preferred()` 等效
#[inline]
pub fn uc_preferred_endpoints(&self) -> &[Endpoint] {
self.uc().preferred()
}
/// 获取存储空间管理服务备选终端列表
///
/// 与 `uc().alternative()` 等效
#[inline]
pub fn uc_alternative_endpoints(&self) -> &[Endpoint] {
self.uc().alternative()
}
/// 获取元数据管理服务主要终端列表
///
/// 与 `rs().preferred()` 等效
#[inline]
pub fn rs_preferred_endpoints(&self) -> &[Endpoint] {
self.rs().preferred()
}
/// 获取元数据管理服务备选终端列表
///
/// 与 `rs().alternative()` 等效
#[inline]
pub fn rs_alternative_endpoints(&self) -> &[Endpoint] {
self.rs().alternative()
}
/// 获取元数据列举服务主要终端列表
///
/// 与 `rsf().preferred()` 等效
#[inline]
pub fn rsf_preferred_endpoints(&self) -> &[Endpoint] {
self.rsf().preferred()
}
/// 获取元数据列举服务备选终端列表
///
/// 与 `rsf().alternative()` 等效
#[inline]
pub fn rsf_alternative_endpoints(&self) -> &[Endpoint] {
self.rsf().alternative()
}
/// 获取 API 入口服务主要终端列表
///
/// 与 `api().preferred()` 等效
#[inline]
pub fn api_preferred_endpoints(&self) -> &[Endpoint] {
self.api().preferred()
}
/// 获取 API 入口服务备选终端列表
///
/// 与 `api().alternative()` 等效
#[inline]
pub fn api_alternative_endpoints(&self) -> &[Endpoint] {
self.api().alternative()
}
/// 获取 S3 入口服务主要终端列表
///
/// 与 `s3().preferred()` 等效
#[inline]
pub fn s3_preferred_endpoints(&self) -> &[Endpoint] {
self.s3().preferred()
}
More examples
src/regions/endpoints_provider/endpoints.rs (line 93)
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
fn from_region(region: &Region, services: &[ServiceName]) -> Self {
let mut builder = EndpointsBuilder {
preferred: vec![],
alternative: vec![],
};
for service in services {
let e = match service {
ServiceName::Up => region.up(),
ServiceName::Io => region.io(),
ServiceName::Uc => region.uc(),
ServiceName::Rs => region.rs(),
ServiceName::Rsf => region.rsf(),
ServiceName::Api => region.api(),
ServiceName::S3 => region.s3(),
};
builder.preferred.extend_from_slice(e.preferred());
builder.alternative.extend_from_slice(e.alternative());
}
builder.build()
}
pub(super) fn from_region_provider(
region_provider: &dyn RegionsProvider,
services: &[ServiceName],
) -> ApiResult<Self> {
Ok(Self::from_region(
region_provider.get(Default::default())?.region(),
services,
))
}
#[cfg(feature = "async")]
pub(super) async fn async_from_region_provider(
region_provider: &dyn RegionsProvider,
services: &[ServiceName],
) -> ApiResult<Self> {
Ok(Self::from_region(
region_provider.async_get(Default::default()).await?.region(),
services,
))
}
pub(in super::super) fn md5(&self) -> &Md5Value {
self.md5.get_or_init(|| {
let mut preferred_endpoints = self.preferred().iter().map(|e| e.to_string()).collect::<Vec<_>>();
let mut alternative_endpoints = self.alternative().iter().map(|e| e.to_string()).collect::<Vec<_>>();
preferred_endpoints.sort();
alternative_endpoints.sort();
let mut md5 = preferred_endpoints
.into_iter()
.fold(Md5::default(), |mut md5, endpoint| {
md5.update(endpoint.as_bytes());
md5.update(b"\0");
md5
});
md5.update(b"\n");
alternative_endpoints
.into_iter()
.fold(md5, |mut md5, endpoint| {
md5.update(endpoint.as_bytes());
md5.update(b"\0");
md5
})
.finalize()
})
}
src/client/call/request_call.rs (line 24)
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
pub(in super::super) fn request_call<E: EndpointsProvider>(
request: SyncInnerRequest<'_, E>,
) -> ApiResult<SyncResponse> {
let (parts, mut body, into_endpoints, service_name, extensions) = request.split();
let options = EndpointsGetOptions::builder().service_names(service_name).build();
let endpoints = into_endpoints.get_endpoints(options)?;
let mut tried_ips = IpAddrsSet::default();
let mut retried = RetriedStatsInfo::default();
return match try_preferred_endpoints(
endpoints.preferred(),
&parts,
&mut body,
extensions,
&mut tried_ips,
&mut retried,
) {
Ok(response) => Ok(response),
Err(err)
if err.retry_decision() == RetryDecision::TryAlternativeEndpoints
&& !endpoints.alternative().is_empty() =>
{
let (_, extensions) = err.split();
retried.switch_to_alternative_endpoints();
debug!("Switch to alternative endpoints");
try_alternative_endpoints(
endpoints.alternative(),
&parts,
&mut body,
extensions,
&mut tried_ips,
&mut retried,
)
}
Err(err) => Err(err.into_response_error()),
};
fn try_preferred_endpoints(
endpoints: &[Endpoint],
parts: &InnerRequestParts<'_>,
body: &mut SyncRequestBody<'_>,
extensions: Extensions,
tried_ips: &mut IpAddrsSet,
retried: &mut RetriedStatsInfo,
) -> Result<SyncResponse, TryErrorWithExtensions> {
try_endpoints(endpoints, parts, body, extensions, tried_ips, retried, true)
}
fn try_alternative_endpoints(
endpoints: &[Endpoint],
parts: &InnerRequestParts<'_>,
body: &mut SyncRequestBody<'_>,
extensions: Extensions,
tried_ips: &mut IpAddrsSet,
retried: &mut RetriedStatsInfo,
) -> ApiResult<SyncResponse> {
try_endpoints(endpoints, parts, body, extensions, tried_ips, retried, false)
.map_err(|err| err.into_response_error())
}
}
#[cfg(feature = "async")]
use super::{
super::{request::AsyncInnerRequest, AsyncRequestBody, AsyncResponse},
try_endpoints::async_try_endpoints,
};
#[cfg(feature = "async")]
pub(in super::super) async fn async_request_call<E: EndpointsProvider>(
request: AsyncInnerRequest<'_, E>,
) -> ApiResult<AsyncResponse> {
let (parts, mut body, into_endpoints, service_name, extensions) = request.split();
let options = EndpointsGetOptions::builder().service_names(service_name).build();
let endpoints = into_endpoints.async_get_endpoints(options).await?;
let mut tried_ips = IpAddrsSet::default();
let mut retried = RetriedStatsInfo::default();
return match try_preferred_endpoints(
endpoints.preferred(),
&parts,
&mut body,
extensions,
&mut tried_ips,
&mut retried,
)
.await
{
Ok(response) => Ok(response),
Err(err)
if err.retry_decision() == RetryDecision::TryAlternativeEndpoints
&& !endpoints.alternative().is_empty() =>
{
let (_, extensions) = err.split();
retried.switch_to_alternative_endpoints();
debug!("Switch to alternative endpoints");
try_alternative_endpoints(
endpoints.alternative(),
&parts,
&mut body,
extensions,
&mut tried_ips,
&mut retried,
)
.await
}
Err(err) => Err(err.into_response_error()),
};
async fn try_preferred_endpoints(
endpoints: &[Endpoint],
parts: &InnerRequestParts<'_>,
body: &mut AsyncRequestBody<'_>,
extensions: Extensions,
tried_ips: &mut IpAddrsSet,
retried: &mut RetriedStatsInfo,
) -> Result<AsyncResponse, TryErrorWithExtensions> {
async_try_endpoints(endpoints, parts, body, extensions, tried_ips, retried, true).await
}
async fn try_alternative_endpoints(
endpoints: &[Endpoint],
parts: &InnerRequestParts<'_>,
body: &mut AsyncRequestBody<'_>,
extensions: Extensions,
tried_ips: &mut IpAddrsSet,
retried: &mut RetriedStatsInfo,
) -> ApiResult<AsyncResponse> {
async_try_endpoints(endpoints, parts, body, extensions, tried_ips, retried, false)
.await
.map_err(|err| err.into_response_error())
}
}
sourcepub fn alternative(&self) -> &[Endpoint]
pub fn alternative(&self) -> &[Endpoint]
返回备选终端地址列表
Examples found in repository?
src/regions/region.rs (line 71)
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
pub fn up_alternative_endpoints(&self) -> &[Endpoint] {
self.up().alternative()
}
/// 获取下载服务主要终端列表
///
/// 与 `io().preferred()` 等效
#[inline]
pub fn io_preferred_endpoints(&self) -> &[Endpoint] {
self.io().preferred()
}
/// 获取下载服务备选终端列表
///
/// 与 `io().alternative()` 等效
#[inline]
pub fn io_alternative_endpoints(&self) -> &[Endpoint] {
self.io().alternative()
}
/// 获取存储空间管理服务主要终端列表
///
/// 与 `uc().preferred()` 等效
#[inline]
pub fn uc_preferred_endpoints(&self) -> &[Endpoint] {
self.uc().preferred()
}
/// 获取存储空间管理服务备选终端列表
///
/// 与 `uc().alternative()` 等效
#[inline]
pub fn uc_alternative_endpoints(&self) -> &[Endpoint] {
self.uc().alternative()
}
/// 获取元数据管理服务主要终端列表
///
/// 与 `rs().preferred()` 等效
#[inline]
pub fn rs_preferred_endpoints(&self) -> &[Endpoint] {
self.rs().preferred()
}
/// 获取元数据管理服务备选终端列表
///
/// 与 `rs().alternative()` 等效
#[inline]
pub fn rs_alternative_endpoints(&self) -> &[Endpoint] {
self.rs().alternative()
}
/// 获取元数据列举服务主要终端列表
///
/// 与 `rsf().preferred()` 等效
#[inline]
pub fn rsf_preferred_endpoints(&self) -> &[Endpoint] {
self.rsf().preferred()
}
/// 获取元数据列举服务备选终端列表
///
/// 与 `rsf().alternative()` 等效
#[inline]
pub fn rsf_alternative_endpoints(&self) -> &[Endpoint] {
self.rsf().alternative()
}
/// 获取 API 入口服务主要终端列表
///
/// 与 `api().preferred()` 等效
#[inline]
pub fn api_preferred_endpoints(&self) -> &[Endpoint] {
self.api().preferred()
}
/// 获取 API 入口服务备选终端列表
///
/// 与 `api().alternative()` 等效
#[inline]
pub fn api_alternative_endpoints(&self) -> &[Endpoint] {
self.api().alternative()
}
/// 获取 S3 入口服务主要终端列表
///
/// 与 `s3().preferred()` 等效
#[inline]
pub fn s3_preferred_endpoints(&self) -> &[Endpoint] {
self.s3().preferred()
}
/// 获取 S3 入口服务备选终端列表
///
/// 与 `s3().alternative()` 等效
#[inline]
pub fn s3_alternative_endpoints(&self) -> &[Endpoint] {
self.s3().alternative()
}
More examples
src/regions/endpoints_provider/endpoints.rs (line 94)
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
fn from_region(region: &Region, services: &[ServiceName]) -> Self {
let mut builder = EndpointsBuilder {
preferred: vec![],
alternative: vec![],
};
for service in services {
let e = match service {
ServiceName::Up => region.up(),
ServiceName::Io => region.io(),
ServiceName::Uc => region.uc(),
ServiceName::Rs => region.rs(),
ServiceName::Rsf => region.rsf(),
ServiceName::Api => region.api(),
ServiceName::S3 => region.s3(),
};
builder.preferred.extend_from_slice(e.preferred());
builder.alternative.extend_from_slice(e.alternative());
}
builder.build()
}
pub(super) fn from_region_provider(
region_provider: &dyn RegionsProvider,
services: &[ServiceName],
) -> ApiResult<Self> {
Ok(Self::from_region(
region_provider.get(Default::default())?.region(),
services,
))
}
#[cfg(feature = "async")]
pub(super) async fn async_from_region_provider(
region_provider: &dyn RegionsProvider,
services: &[ServiceName],
) -> ApiResult<Self> {
Ok(Self::from_region(
region_provider.async_get(Default::default()).await?.region(),
services,
))
}
pub(in super::super) fn md5(&self) -> &Md5Value {
self.md5.get_or_init(|| {
let mut preferred_endpoints = self.preferred().iter().map(|e| e.to_string()).collect::<Vec<_>>();
let mut alternative_endpoints = self.alternative().iter().map(|e| e.to_string()).collect::<Vec<_>>();
preferred_endpoints.sort();
alternative_endpoints.sort();
let mut md5 = preferred_endpoints
.into_iter()
.fold(Md5::default(), |mut md5, endpoint| {
md5.update(endpoint.as_bytes());
md5.update(b"\0");
md5
});
md5.update(b"\n");
alternative_endpoints
.into_iter()
.fold(md5, |mut md5, endpoint| {
md5.update(endpoint.as_bytes());
md5.update(b"\0");
md5
})
.finalize()
})
}
src/client/call/request_call.rs (line 34)
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
pub(in super::super) fn request_call<E: EndpointsProvider>(
request: SyncInnerRequest<'_, E>,
) -> ApiResult<SyncResponse> {
let (parts, mut body, into_endpoints, service_name, extensions) = request.split();
let options = EndpointsGetOptions::builder().service_names(service_name).build();
let endpoints = into_endpoints.get_endpoints(options)?;
let mut tried_ips = IpAddrsSet::default();
let mut retried = RetriedStatsInfo::default();
return match try_preferred_endpoints(
endpoints.preferred(),
&parts,
&mut body,
extensions,
&mut tried_ips,
&mut retried,
) {
Ok(response) => Ok(response),
Err(err)
if err.retry_decision() == RetryDecision::TryAlternativeEndpoints
&& !endpoints.alternative().is_empty() =>
{
let (_, extensions) = err.split();
retried.switch_to_alternative_endpoints();
debug!("Switch to alternative endpoints");
try_alternative_endpoints(
endpoints.alternative(),
&parts,
&mut body,
extensions,
&mut tried_ips,
&mut retried,
)
}
Err(err) => Err(err.into_response_error()),
};
fn try_preferred_endpoints(
endpoints: &[Endpoint],
parts: &InnerRequestParts<'_>,
body: &mut SyncRequestBody<'_>,
extensions: Extensions,
tried_ips: &mut IpAddrsSet,
retried: &mut RetriedStatsInfo,
) -> Result<SyncResponse, TryErrorWithExtensions> {
try_endpoints(endpoints, parts, body, extensions, tried_ips, retried, true)
}
fn try_alternative_endpoints(
endpoints: &[Endpoint],
parts: &InnerRequestParts<'_>,
body: &mut SyncRequestBody<'_>,
extensions: Extensions,
tried_ips: &mut IpAddrsSet,
retried: &mut RetriedStatsInfo,
) -> ApiResult<SyncResponse> {
try_endpoints(endpoints, parts, body, extensions, tried_ips, retried, false)
.map_err(|err| err.into_response_error())
}
}
#[cfg(feature = "async")]
use super::{
super::{request::AsyncInnerRequest, AsyncRequestBody, AsyncResponse},
try_endpoints::async_try_endpoints,
};
#[cfg(feature = "async")]
pub(in super::super) async fn async_request_call<E: EndpointsProvider>(
request: AsyncInnerRequest<'_, E>,
) -> ApiResult<AsyncResponse> {
let (parts, mut body, into_endpoints, service_name, extensions) = request.split();
let options = EndpointsGetOptions::builder().service_names(service_name).build();
let endpoints = into_endpoints.async_get_endpoints(options).await?;
let mut tried_ips = IpAddrsSet::default();
let mut retried = RetriedStatsInfo::default();
return match try_preferred_endpoints(
endpoints.preferred(),
&parts,
&mut body,
extensions,
&mut tried_ips,
&mut retried,
)
.await
{
Ok(response) => Ok(response),
Err(err)
if err.retry_decision() == RetryDecision::TryAlternativeEndpoints
&& !endpoints.alternative().is_empty() =>
{
let (_, extensions) = err.split();
retried.switch_to_alternative_endpoints();
debug!("Switch to alternative endpoints");
try_alternative_endpoints(
endpoints.alternative(),
&parts,
&mut body,
extensions,
&mut tried_ips,
&mut retried,
)
.await
}
Err(err) => Err(err.into_response_error()),
};
async fn try_preferred_endpoints(
endpoints: &[Endpoint],
parts: &InnerRequestParts<'_>,
body: &mut AsyncRequestBody<'_>,
extensions: Extensions,
tried_ips: &mut IpAddrsSet,
retried: &mut RetriedStatsInfo,
) -> Result<AsyncResponse, TryErrorWithExtensions> {
async_try_endpoints(endpoints, parts, body, extensions, tried_ips, retried, true).await
}
async fn try_alternative_endpoints(
endpoints: &[Endpoint],
parts: &InnerRequestParts<'_>,
body: &mut AsyncRequestBody<'_>,
extensions: Extensions,
tried_ips: &mut IpAddrsSet,
retried: &mut RetriedStatsInfo,
) -> ApiResult<AsyncResponse> {
async_try_endpoints(endpoints, parts, body, extensions, tried_ips, retried, false)
.await
.map_err(|err| err.into_response_error())
}
}
Trait Implementations§
source§impl<'de> Deserialize<'de> for Endpoints
impl<'de> Deserialize<'de> for Endpoints
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl EndpointsProvider for Endpoints
impl EndpointsProvider for Endpoints
source§fn get_endpoints<'e>(
&'e self,
_services: GetOptions<'_>
) -> ApiResult<Cow<'e, Endpoints>>
fn get_endpoints<'e>(
&'e self,
_services: GetOptions<'_>
) -> ApiResult<Cow<'e, Endpoints>>
获取终端地址列表 Read more
source§impl FromIterator<Endpoint> for Endpoints
impl FromIterator<Endpoint> for Endpoints
source§impl<'a> IntoIterator for &'a Endpoints
impl<'a> IntoIterator for &'a Endpoints
source§impl PartialEq<Endpoints> for Endpoints
impl PartialEq<Endpoints> for Endpoints
impl Eq for Endpoints
impl StructuralEq for Endpoints
impl StructuralPartialEq for Endpoints
Auto Trait Implementations§
impl RefUnwindSafe for Endpoints
impl Send for Endpoints
impl Sync for Endpoints
impl Unpin for Endpoints
impl UnwindSafe for Endpoints
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self
and passes that borrow into the pipe function. Read moresource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self
and passes that borrow into the pipe function. Read moresource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
Borrows
self
, then passes self.as_ref()
into the pipe function.source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
Mutably borrows
self
, then passes self.as_mut()
into the pipe
function.source§impl<T> Tap for T
impl<T> Tap for T
source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Immutable access to the
Borrow<B>
of a value. Read moresource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
Mutable access to the
BorrowMut<B>
of a value. Read moresource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
Immutable access to the
AsRef<R>
view of a value. Read moresource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
Mutable access to the
AsMut<R>
view of a value. Read moresource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
Immutable access to the
Deref::Target
of a value. Read moresource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Mutable access to the
Deref::Target
of a value. Read moresource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap()
only in debug builds, and is erased in release builds.source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Calls
.tap_borrow()
only in debug builds, and is erased in release
builds.source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
Calls
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
Calls
.tap_ref()
only in debug builds, and is erased in release
builds.source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
Calls
.tap_ref_mut()
only in debug builds, and is erased in release
builds.