Skip to main content

UnscopedToken

Trait UnscopedToken 

Source
pub trait UnscopedToken: TokenTrait {
    type ConstructionError;

    // Required method
    fn try_new() -> Result<Self, Self::ConstructionError>;

    // Provided method
    fn new() -> Self
       where Self: UnscopedToken<ConstructionError = Infallible> { ... }
}
Expand description

A token that isn’t intrinsically tied to a scope.

Most token types aren’t, but some like [GhostToken] are.

Required Associated Types§

Source

type ConstructionError

Constructing a token may fail.

Required Methods§

Source

fn try_new() -> Result<Self, Self::ConstructionError>

Constructs a new Token.

§Errors

Some token implementations may chose to be constructible only once, or only while holding a given lock.

Provided Methods§

Source

fn new() -> Self
where Self: UnscopedToken<ConstructionError = Infallible>,

Constructs a new Token. This method may be used instead of UnscopedToken::try_new when .

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§