pub struct CallOpt {
pub timeout: Option<Duration>,
pub tags: TypeMap,
pub faststr_tags: FastStrMap,
}client only.Expand description
Call options for requests
Fields§
§timeout: Option<Duration>Timeout of the whole request
This timeout includes connect, sending request headers, receiving response headers, but without receiving streaming data.
Additional information of the endpoint.
Users can use tags to store custom data, such as the datacenter name or the region name,
which can be used by the service discoverer.
A optimized typemap for storing additional information of the endpoint.
Use FastStrMap instead of TypeMap can reduce the Box allocation.
This is mainly for performance optimization.
Implementations§
Source§impl CallOpt
impl CallOpt
Sourcepub fn set_timeout(&mut self, timeout: Duration)
pub fn set_timeout(&mut self, timeout: Duration)
Set a timeout for the CallOpt.
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Consume current CallOpt and return a new one with the given timeout.
Sourcepub fn with<T: Send + Sync + 'static>(self, val: T) -> Self
pub fn with<T: Send + Sync + 'static>(self, val: T) -> Self
Consume current CallOpt and return a new one with the tag.
Sourcepub fn get<T: 'static>(&self) -> Option<&T>
pub fn get<T: 'static>(&self) -> Option<&T>
Get a reference to a tag previously inserted on this CallOpt.
Sourcepub fn contains_faststr<T: 'static>(&self) -> bool
pub fn contains_faststr<T: 'static>(&self) -> bool
Check if CallOpt tags contain entry.
Sourcepub fn insert_faststr<T: Send + Sync + 'static>(&mut self, val: FastStr)
pub fn insert_faststr<T: Send + Sync + 'static>(&mut self, val: FastStr)
Insert a tag into this CallOpt.
Sourcepub fn with_faststr<T: Send + Sync + 'static>(self, val: FastStr) -> Self
pub fn with_faststr<T: Send + Sync + 'static>(self, val: FastStr) -> Self
Consume current CallOpt and return a new one with the tag.
Sourcepub fn get_faststr<T: 'static>(&self) -> Option<&FastStr>
pub fn get_faststr<T: 'static>(&self) -> Option<&FastStr>
Get a reference to a tag previously inserted on this CallOpt.