pub struct Unit { /* private fields */ }Expand description
The Unit application context.
This object wraps the libunit library, which talks to the Unit server over
shared memory and a unix socket in order to receive data about requests.
Implementations
sourceimpl Unit
impl Unit
sourcepub fn new() -> Result<Self, UnitInitError>
pub fn new() -> Result<Self, UnitInitError>
Create a new Unit context and initialize the Unit application.
Note: Only one Unit object may be active in a single process.
sourcepub fn set_request_handler(&mut self, f: impl UnitService + 'static)
pub fn set_request_handler(&mut self, f: impl UnitService + 'static)
Set a request handler for the Unit application.
The handler must be a function or lambda function that takes a
UnitRequest object and returns a
UnitResult<()>.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Unit
impl !Send for Unit
impl !Sync for Unit
impl Unpin for Unit
impl !UnwindSafe for Unit
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more