Struct sentry::Client
[−]
[src]
pub struct Client { /* fields omitted */ }
The Sentry client object.
Shim Behavior
This type is technically available in Shim mode but cannot be constructed. It's passed to some callbacks but those callbacks will never be executed if the shim is not configured so a lot of the implementations are irrelevant as the code is effectively dead.
To see what types are available in shim only mode refer to the shim client docs.
Methods
impl Client
[src]
pub fn from_config<C: IntoClientConfig>(cfg: C) -> Option<Client>
[src]
Creates a new Sentry client from a config helper.
As the config helper can also disable the client this method might return
None
instead. This is what sentry::init
uses internally before binding
the client.
The client config can be of one of many formats as implemented by the
IntoClientConfig
trait. The most common form is to just supply a
string with the DSN.
Supported Configs
The following common values are supported for the client config:
()
: pick up the default config from the environment only&str
/String
/&OsStr
/String
: configure the client with the given DSNDsn
/&Dsn
: configure the client with a given DSN(C, options)
: configure the client from the given DSN and optional options.
The tuple form lets you do things like (Dsn, ClientOptions)
for instance.
Panics
The IntoClientConfig
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.
pub fn with_dsn(dsn: Dsn) -> Client
[src]
Creates a new sentry client for the given DSN.
pub fn with_dsn_and_options(dsn: Dsn, options: ClientOptions) -> Client
[src]
Creates a new sentry client for the given DSN.
pub fn disabled() -> Client
[src]
Creates a new client that does not send anything.
This is useful when general sentry handling is wanted but a client cannot be bound yet as the DSN might not be available yet. In that case a disabled client can be bound and later replaced by another one.
A disabled client can be detected by inspecting the DSN. If the DSN is None
then
the client is disabled.
pub fn disabled_with_options(options: ClientOptions) -> Client
[src]
Creates a new client that does not send anything with custom options.
pub fn options(&self) -> &ClientOptions
[src]
Returns the options of this client.
pub fn dsn(&self) -> Option<&Dsn>
[src]
Returns the DSN that constructed this client.
If the client is in disabled mode this returns None
.
pub fn capture_event(
&self,
event: Event<'static>,
scope: Option<&Scope>
) -> Uuid
[src]
&self,
event: Event<'static>,
scope: Option<&Scope>
) -> Uuid
Captures an event and sends it to sentry.
pub fn drain_events(&self, timeout: Option<Duration>) -> bool
[src]
Drains all pending events up to the current time.
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 forever.
Trait Implementations
impl Clone for Client
[src]
fn clone(&self) -> Client
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more