Skip to main content

Builder

Struct Builder 

Source
pub struct Builder { /* private fields */ }
Expand description

A builder for WebVLogger.

Implementations§

Source§

impl Builder

Source

pub fn new() -> Self

Create a new Builder for WebVLogger with the default port 0, which means the OS will choose the port.

Source

pub fn port(&mut self, port: u16) -> &mut Self

Set the port on which the server will be made available.

If set to 0, an available port will be choosen by the OS.

Source

pub fn add_target(&mut self, target: &str) -> &mut Self

Add a target to the target whitelist. If the whitelist is left empty, all targets are allowed.

Source

pub fn targets_from_env(&mut self) -> &mut Self

Read the targets from the

Source

pub fn init(&self) -> Result<u16, InitError>

Initialize the WebVLogger and set it as the global vlogger for v_log.

Returns the actual port, which the server runs on. This is only relevant if the port was set to 0.

§Errors

If the global vlogger has already been set an InitError::SetVLoggerError is returned. If the server could not be started on the chosen port, the std::io::Error is returned inside InitError::TcpError.

Auto Trait Implementations§

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