pub struct Client { /* private fields */ }
Expand description
The Sentry client object.
Implementations
sourceimpl Client
impl Client
sourcepub fn from_config<O: Into<ClientOptions>>(opts: O) -> Client
pub fn from_config<O: Into<ClientOptions>>(opts: O) -> Client
Creates a new Sentry client from a config.
Supported Configs
The following common values are supported for the client config:
ClientOptions
: configure the client with the given client options.()
or empty string: Disable the client.&str
/String
/&OsStr
/String
: configure the client with the given DSN.Dsn
/&Dsn
: configure the client with a given DSN.(Dsn, ClientOptions)
: configure the client from the given DSN and optional options.
The Default
implementation of ClientOptions
pulls in the DSN from the
SENTRY_DSN
environment variable.
Panics
The Into<ClientOptions>
implementations can panic for the forms where a DSN needs to be
parsed. If you want to handle invalid DSNs you need to parse them manually by calling
parse on it and handle the error.
sourcepub fn with_options(options: ClientOptions) -> Client
pub fn with_options(options: ClientOptions) -> Client
Creates a new sentry client for the given options.
If the DSN on the options is set to None
the client will be entirely
disabled.
sourcepub fn options(&self) -> &ClientOptions
pub fn options(&self) -> &ClientOptions
Returns the options of this client.
sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Quick check to see if the client is enabled.
sourcepub fn capture_event(
&self,
event: Event<'static>,
scope: Option<&Scope>
) -> Uuid
pub fn capture_event(
&self,
event: Event<'static>,
scope: Option<&Scope>
) -> Uuid
Captures an event and sends it to sentry.
sourcepub fn close(&self, timeout: Option<Duration>) -> bool
pub fn close(&self, timeout: Option<Duration>) -> bool
Drains all pending events and shuts down the transport behind the client. After shutting down the transport is removed.
This returns true
if the queue was successfully drained in the
given time or false
if not (for instance because of a timeout).
If no timeout is provided the client will wait for as long a
shutdown_timeout
in the client options.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more