Struct token_cell::TokenCell [−][src]
#[repr(C)]pub struct TokenCell<Token: TokenTrait, T> { /* fields omitted */ }Expand description
A cell which requires a token for interior read/write access.
Implementations
impl<Token: TokenTrait, T> TokenCell<Token, T> where
Token::Checker: TokenChecker<Token, Error = Infallible>,
impl<Token: TokenTrait, T> TokenCell<Token, T> where
Token::Checker: TokenChecker<Token, Error = Infallible>,
Builds a TokenCell attached to a token
Builds a TokenCell attached to a token
Fallible equivalent of TokenCell::swap, for runtime-checked tokens.
Since token mismatch is indicative that the wrong token was used to interact with the cell, you should treat these as unrecoverable errors by unwrapping the result.
pub fn try_borrow<'l>(
&'l self,
token: &'l Token
) -> Result<&'l T, <Token::Checker as TokenChecker<Token>>::Error>
pub fn try_borrow<'l>(
&'l self,
token: &'l Token
) -> Result<&'l T, <Token::Checker as TokenChecker<Token>>::Error>
Fallible equivalent of TokenCell::borrow, for runtime-checked tokens.
Since token mismatch is indicative that the wrong token was used to interact with the cell, you should treat these as unrecoverable errors by unwrapping the result.
pub fn try_borrow_mut<'l>(
&'l self,
token: &'l mut Token
) -> Result<&'l mut T, <Token::Checker as TokenChecker<Token>>::Error>
pub fn try_borrow_mut<'l>(
&'l self,
token: &'l mut Token
) -> Result<&'l mut T, <Token::Checker as TokenChecker<Token>>::Error>
Fallible equivalent of TokenCell::borrow_mut, for runtime-checked tokens.
Since token mismatch is indicative that the wrong token was used to interact with the cell, you should treat these as unrecoverable errors by unwrapping the result.