pub struct TokenBinding {
pub token_type_id: TypeId,
pub token_type_name: &'static str,
pub service_type_id: TypeId,
pub service_type_name: &'static str,
pub impl_type_id: TypeId,
pub impl_type_name: &'static str,
pub name: Option<String>,
}Expand description
Metadata for a service token binding
Contains compile-time information about a token-to-implementation binding for use in dependency resolution and validation.
Fields§
§token_type_id: TypeIdThe token type identifier
token_type_name: &'static strThe token type name (for debugging)
service_type_id: TypeIdThe service type identifier
service_type_name: &'static strThe service type name (for debugging)
impl_type_id: TypeIdThe implementation type identifier
impl_type_name: &'static strThe implementation type name (for debugging)
name: Option<String>Optional named identifier for multiple implementations
Implementations§
Source§impl TokenBinding
impl TokenBinding
Sourcepub fn to_service_id(&self) -> ServiceId
pub fn to_service_id(&self) -> ServiceId
Create a ServiceId for this token binding
Sourcepub fn matches_token<Token: ServiceToken>(&self) -> bool
pub fn matches_token<Token: ServiceToken>(&self) -> bool
Check if this binding matches a token type
Sourcepub fn validate_implementation<Token, Impl>() -> Result<(), String>
pub fn validate_implementation<Token, Impl>() -> Result<(), String>
Validate that the implementation can be cast to the service type
This performs compile-time type checking to ensure the implementation actually implements the service trait.
Trait Implementations§
Source§impl Clone for TokenBinding
impl Clone for TokenBinding
Source§fn clone(&self) -> TokenBinding
fn clone(&self) -> TokenBinding
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 TokenBinding
impl RefUnwindSafe for TokenBinding
impl Send for TokenBinding
impl Sync for TokenBinding
impl Unpin for TokenBinding
impl UnwindSafe for TokenBinding
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