pub struct Builder { /* private fields */ }Expand description
A builder for WebVLogger.
Implementations§
Source§impl Builder
impl Builder
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new Builder for WebVLogger with
the default port 0, which means the OS will choose the port.
Sourcepub fn port(&mut self, port: u16) -> &mut Self
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.
Sourcepub fn add_target(&mut self, target: &str) -> &mut Self
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.
Sourcepub fn targets_from_env(&mut self) -> &mut Self
pub fn targets_from_env(&mut self) -> &mut Self
Read the targets from the
Sourcepub fn init(&self) -> Result<u16, InitError>
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§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin for Builder
impl UnsafeUnpin for Builder
impl UnwindSafe for Builder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more