Struct NetXServer

Source
pub struct NetXServer<T: ICreateController + 'static> { /* private fields */ }
Expand description

NetX Service structure.

Implementations§

Source§

impl<T> NetXServer<T>
where T: ICreateController + 'static,

Source

pub async fn new(option: ServerOption, impl_controller: T) -> NetXServer<T>

Creates a new NetXServer instance.

§Arguments
  • option - The server options.
  • impl_controller - The controller implementation.
§Returns

A new instance of NetXServer.

§Errors

This function will return an error if the server initialization fails.

Source

pub fn get_token_manager(&self) -> Weak<dyn ITokenManager<T::Controller>>

Retrieves the token manager as a weak reference.

§Returns

A Weak reference to the ITokenManager.

Source

pub async fn start(&self) -> Result<JoinHandle<Result<()>>>

Starts the server asynchronously.

§Returns

A Result containing a JoinHandle that resolves to a Result.

Source

pub async fn start_block(&self) -> Result<()>

Starts the server and blocks until it stops.

§Returns

A Result indicating success or failure.

Trait Implementations§

Source§

impl<T: ICreateController + 'static> Send for NetXServer<T>

Implement Send for NetXServer.

Source§

impl<T: ICreateController + 'static> Sync for NetXServer<T>

Implement Sync for NetXServer.

Auto Trait Implementations§

§

impl<T> Freeze for NetXServer<T>

§

impl<T> !RefUnwindSafe for NetXServer<T>

§

impl<T> Unpin for NetXServer<T>

§

impl<T> !UnwindSafe for NetXServer<T>

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
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.

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.