pub struct TransportContext {
EnvironmentInfo: EnvironmentInfo,
RequirementsInfo: TransportRequirements,
ConstraintsInfo: TransportConstraints,
AvailableTransports: HashSet<TransportType>,
}Expand description
Context information for transport selection.
Fields§
§EnvironmentInfo: EnvironmentInfo§RequirementsInfo: TransportRequirements§ConstraintsInfo: TransportConstraints§AvailableTransports: HashSet<TransportType>Implementations§
Source§impl TransportContext
impl TransportContext
Sourcepub fn New(
EnvironmentInfo: EnvironmentInfo,
RequirementsInfo: TransportRequirements,
ConstraintsInfo: TransportConstraints,
) -> Self
pub fn New( EnvironmentInfo: EnvironmentInfo, RequirementsInfo: TransportRequirements, ConstraintsInfo: TransportConstraints, ) -> Self
Creates a new transport selection context.
Sourcepub fn Detect() -> Self
pub fn Detect() -> Self
Detects the current environment and creates a context with default requirements.
Sourcepub fn Environment(&self) -> &EnvironmentInfo
pub fn Environment(&self) -> &EnvironmentInfo
Gets the environment information.
Sourcepub fn Requirements(&self) -> &TransportRequirements
pub fn Requirements(&self) -> &TransportRequirements
Gets the transport requirements.
Sourcepub fn Constraints(&self) -> &TransportConstraints
pub fn Constraints(&self) -> &TransportConstraints
Gets the transport constraints.
Sourcepub fn TransportAvailable(&self, TransportKind: TransportType) -> bool
pub fn TransportAvailable(&self, TransportKind: TransportType) -> bool
Checks if a transport type is available in this environment.
Sourcepub fn IsAllowed(&self, TransportKind: TransportType) -> bool
pub fn IsAllowed(&self, TransportKind: TransportType) -> bool
Checks if a transport type is allowed by constraints.
Sourcepub fn WithAvailableTransports(self, Transports: Vec<TransportType>) -> Self
pub fn WithAvailableTransports(self, Transports: Vec<TransportType>) -> Self
Sets custom available transports (for testing or override).
Trait Implementations§
Source§impl Clone for TransportContext
impl Clone for TransportContext
Source§fn clone(&self) -> TransportContext
fn clone(&self) -> TransportContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TransportContext
impl RefUnwindSafe for TransportContext
impl Send for TransportContext
impl Sync for TransportContext
impl Unpin for TransportContext
impl UnsafeUnpin for TransportContext
impl UnwindSafe for TransportContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more