INNER CODE UNIT · Rust

new

trussed-dev/trussed · src/backend.rs:106

    pub fn new(backend: Option<T>) -> Self {
        Self(backend)
    }

    /// Returns a mutable reference to the wrapped backend or [`Error::RequestNotAvailable`][] if
    /// it is `None`.
    pub fn inner(&mut self) -> Result<&mut T, Error> {
        self.0.as_mut().ok_or(Error::RequestNotAvailable)
    }

    /// Returns the wrapped backend.
    pub fn into_inner(self) -> Option<T> {
        self.0
    }
}

impl<T> Default for OptionalBackend<T> {
    fn default() -> Self {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…