pub struct Builder { /* private fields */ }Expand description
The builder can be use to customize the instrumentation.
Implementations§
source§impl Builder
impl Builder
sourcepub fn host(&mut self, host: IpAddr) -> &mut Self
pub fn host(&mut self, host: IpAddr) -> &mut Self
Specify which IP addresses the instrumentation server should listen on.
You can set this to Ipv4Addr::UNSPECIFIED to listen on all addresses, including LAN and public ones.
default: Ipv4Addr::LOCALHOST
sourcepub fn port(&mut self, port: u16) -> &mut Self
pub fn port(&mut self, port: u16) -> &mut Self
Specify the instrumentation server port.
Currently devtools does not pick a random free port if the configured one
is already taken, so you will need to configure a different one manually.
default: 3000
sourcepub fn strict_port(&mut self, strict: bool) -> &mut Self
pub fn strict_port(&mut self, strict: bool) -> &mut Self
By default the instrumentation will pick a free port if the default (or configured) one is
no available. By setting this to true you can disable this behaviour and cause
the server to abort instead.
default: false
sourcepub fn publish_interval(&mut self, interval: Duration) -> &mut Self
pub fn publish_interval(&mut self, interval: Duration) -> &mut Self
The interval in which updates are sent to the connected UI.
You can tweak this setting to reduce the time between updates, when for example your app is generating a lot of events, the buffer might fill up and cause some events to get lost.
default: 200ms
sourcepub fn init<R: Runtime>(self) -> TauriPlugin<R>
pub fn init<R: Runtime>(self) -> TauriPlugin<R>
Initializes the global tracing subscriber.
This should be called as early in the execution of the app as possible. Any events that occur before initialization will be ignored.
This function returns a tauri::plugin::TauriPlugin that needs to be added to the
Tauri app in order to properly instrument it.
§Example
Make sure to check out the examples sub folder for a fully working setup.
let devtools_plugin = devtools::Builder::default().init();
tauri::Builder::default()
.plugin(devtools_plugin)
// ... the rest of the tauri setup code§Panics
This function will panic if it is called more than once, or if another library has already initialized a global tracing subscriber.
sourcepub fn try_init<R: Runtime>(self) -> Result<TauriPlugin<R>>
pub fn try_init<R: Runtime>(self) -> Result<TauriPlugin<R>>
Initializes the global tracing subscriber.
This should be called as early in the execution of the app as possible. Any events that occur before initialization will be ignored.
This function returns a tauri::plugin::TauriPlugin that needs to be added to the
Tauri app in order to properly instrument it.
§Example
Make sure to check out the examples sub folder for a fully working setup.
fn main() -> Result<(), Box<dyn std::error::Error>> {
let devtools_plugin = devtools::Builder::default().try_init()?;
tauri::Builder::default()
.plugin(devtools_plugin)
// ... the rest of the tauri setup code
Ok(())
}§Errors
This function will fail if it is called more than once, or if another library has already initialized a global tracing subscriber.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Builder
impl RefUnwindSafe for Builder
impl Send for Builder
impl Sync for Builder
impl Unpin 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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request