pub struct Client { /* private fields */ }
Expand description
The access point to the library.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new<T: Into<String>>(access_token: T, environment: T) -> Client
pub fn new<T: Into<String>>(access_token: T, environment: T) -> Client
Create a new Client
.
Your available environment
s are listed at
https://rollbar.com/{your_organization}/{your_app}/settings/general.
You can get the access_token
at
https://rollbar.com/{your_organization}/{your_app}/settings/access_tokens.
Examples found in repository?
examples/message.rs (line 5)
4fn main() {
5 let client = rollbar::Client::new("ACCESS_TOKEN", "ENVIRONMENT");
6 let _ = report_message!(client, "hai").join();
7
8 /* // `report_message!` expands to the following code:
9 * client.build_report()
10 * .from_message("hai")
11 * .with_level(rollbar::Level::INFO)
12 * .send();
13 * // If you want to customize the message, you might not want to use the macro.
14 * // Join the thread only for testing purposes.
15 */
16}
More examples
examples/panic.rs (line 6)
5fn main() {
6 let client = rollbar::Client::new("ACCESS_TOKEN", "ENVIRONMENT");
7 report_panics!(client);
8
9 /* // `report_panics!` expands to the following code:
10 * std::panic::set_hook(Box::new(move |panic_info| {
11 * let backtrace = backtrace::Backtrace::new();
12 * client.build_report()
13 * .from_panic(panic_info)
14 * .with_backtrace(&backtrace)
15 * .send();
16 * }));
17 * // If you want to customize the reports, you might not want to use the macro.
18 * // Join the thread only for testing purposes.
19 */
20
21 let zero = "0".parse::<i32>().unwrap(); // let's trick the lint a bit!
22 let _ = 42/zero;
23}
examples/error_message.rs (line 6)
5fn main() {
6 let client = rollbar::Client::new("ACCESS_TOKEN", "ENVIRONMENT");
7 let _ = report_error_message!(client, "_| ̄|○").join();
8
9 /* // `report_error_message!` expands to the following code:
10 * let backtrace = backtrace::Backtrace::new();
11 * let line = line!();
12 *
13 * client.build_report()
14 * .from_error_message("_| ̄|○")
15 * .with_frame(rollbar::FrameBuilder::new()
16 * .with_line_number(line)
17 * .with_file_name(file!())
18 * .build())
19 * .with_backtrace(&backtrace)
20 * .send();
21 * // If you want to customize the report, you might not want to use the macro.
22 * // Join the thread only for testing purposes.
23 */
24}
examples/error.rs (line 6)
5fn main() {
6 let client = rollbar::Client::new("ACCESS_TOKEN", "ENVIRONMENT");
7
8 match "笑".parse::<i32>() {
9 Ok(_) => { println!("lolnope"); },
10 Err(e) => { let _ = report_error!(client, e).join(); }
11 }
12
13 /* // `report_error!` expands to the following code:
14 * let backtrace = backtrace::Backtrace::new();
15 * let line = line!() - 2;
16 *
17 * client.build_report()
18 * .from_error(&e)
19 * .with_frame(rollbar::FrameBuilder::new()
20 * .with_line_number(line)
21 * .with_file_name(file!())
22 * .build())
23 * .with_backtrace(&backtrace)
24 * .send();
25 * // If you want to customize the report, you might not want to use the macro.
26 * // Join the thread only for testing purposes.
27 */
28}
Sourcepub fn build_report(&self) -> ReportBuilder<'_>
pub fn build_report(&self) -> ReportBuilder<'_>
Create a ReportBuilder
to build a new report for Rollbar.
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more