Skip to main content

Server

Struct Server 

Source
pub struct Server {
    pub cfm: SharedConfium,
    pub dispatch: Dispatch,
    pub cancel: CancellationToken,
}
Expand description

The daemon’s shared state: the engine, the dispatch table, and a shutdown signal.

Fields§

§cfm: SharedConfium

The single Confium instance owned by the daemon. All method handlers dispatch against this.

§dispatch: Dispatch

Method-name → handler table.

§cancel: CancellationToken

Cancellation token: set when shutdown is called or the process receives a signal. Stops the accept loop and drains.

Implementations§

Source§

impl Server

Source

pub fn new() -> Self

Construct a server with a fresh Confium (audit logger resolved from the environment) and the default dispatch table.

Source

pub fn with_confium(cfm: Confium) -> Self

Construct a server with an explicit Confium (used by tests that want the audit logger disabled).

Source

pub async fn serve_tcp(self: Rc<Self>, listener: TcpListener) -> Result<()>

Run the accept loop on a TCP listener until shutdown. Must be called from within a [LocalSet] — see Server::run_tcp.

Source

pub async fn serve_unix(self: Rc<Self>, listener: UnixListener) -> Result<()>

Run the accept loop on a Unix socket listener until shutdown.

Source

pub async fn run_tcp(self: Rc<Self>, listener: TcpListener) -> Result<()>

Drive a TCP listener inside a [LocalSet] until shutdown. This is the convenience entry point for main and tests: it creates the LocalSet, enters it, and runs the accept loop.

Source

pub async fn run_unix(self: Rc<Self>, listener: UnixListener) -> Result<()>

Drive a Unix listener inside a [LocalSet] until shutdown.

Trait Implementations§

Source§

impl Default for Server

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Server

§

impl !Send for Server

§

impl !Sync for Server

§

impl !UnwindSafe for Server

§

impl Freeze for Server

§

impl Unpin for Server

§

impl UnsafeUnpin for Server

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V