/// Enters this span, returning a guard that will exit the span when dropped.
///
/// If this span is enabled by the current subscriber, then this function will
/// call [`Subscriber::enter`] with the span's [`Id`], and dropping the guard
/// will call [`Subscriber::exit`]. If the span is disabled, this does nothing.
///
/// # Examples
///
/// ```
/// #[macro_use] extern crate tokio_trace;
/// # use tokio_trace::Level;
/// # fn main() {
/// let span = span!(Level::INFO, "my_span");
/// let guard = span.enter();
///
/// // code here is within the span
///
/// drop(guard);
///
/// // code here is no longer within the span
///
/// # }
/// ```
///
/// Guards need not be explicitly dropped:
///
/// ```
/// #[macro_use] extern crate tokio_trace;
/// # fn main() {
/// fn my_function() -> String {
///     // enter a span for the duration of this function.
///     let span = trace_span!("my_function");
///     let _enter = span.enter();
///
///     // anything happening in functions we call is still inside the span...
///     my_other_function();
///
///     // returning from the function drops the guard, exiting the span.
///     return "Hello world".to_owned();
/// }
///
/// fn my_other_function() {
///     // ...
/// }
/// # }
/// ```
///
/// Sub-scopes may be created to limit the duration for which the span is
/// entered:
///
/// ```
/// #[macro_use] extern crate tokio_trace;
/// # fn main() {
/// let span = info_span!("my_great_span");
///
/// {
///     let _enter = span.enter();
///
///     // this event occurs inside the span.
///     info!("i'm in the span!");
///
///     // exiting the scope drops the guard, exiting the span.
/// }
///
/// // this event is not inside the span.
/// info!("i'm outside the span!")
/// # }
/// ```
///
/// [`Subscriber::enter`]: ../subscriber/trait.Subscriber.html#method.enter
/// [`Subscriber::exit`]: ../subscriber/trait.Subscriber.html#method.exit
/// [`Id`]: ../struct.Id.html
Enters this span, returning a guard that will exit the span when dropped.
Enters this span returning a guard that will exit the span when dropped .
pub fn enter<'a>(&'a self) -> Entered<'a> {
        if let Some(ref inner) = self.inner.as_ref() {
            inner.subscriber.enter(&inner.id);
        }
        self.log(format_args!("-> {}", self.meta.name));
        Entered { span: self }
    }
pub fn enter < ' a > ( & ' a self ) -> Entered < ' a > { if let Some ( ref inner ) = self . inner . as_ref ( ) { inner . subscriber . enter ( & inner . id ) ; } self . log ( format_args ! ( " " self meta name ) ) ; Entered { span : self } }
Enters this span, returning a guard that will exit the span when dropped.
Enters this span returning a guard that will exit the span when dropped .
&'a self
examples
None
[macro_use] extern crate tokio_trace;
None
use tokio_trace::level;
None
fn main() {


code here is within the span

drop(guard).

code here is no longer within the span
code here is within the span drop ( guard ) . code here is no longer within the span
}


Guards need not be explicitly dropped.


Guards need not be explicitly dropped .
[macro_use] extern crate tokio_trace;
None
fn main() {
fn my_function() -> String {
enter a span for the duration of this function.
let span = trace_span!("my_function");
let _enter = span.enter().

anything happening in functions we call is still inside the span
my_other_function().

returning from the function drops the guard, exiting the span.
return "Hello world".to_owned();
}

fn my_other_function() {

}
fn my_function () - > String { enter a span for the duration of this function . let span = trace_span! ( " my_function " ) ; let _enter = span . enter () . anything happening in functions we call is still inside the span my_other_function () . returning from the function drops the guard exiting the span . return " Hello world " . to_owned () ; } fn my_other_function () { }
}


Sub-scopes may be created to limit the duration for which the span is
entered.


Sub - scopes may be created to limit the duration for which the span is entered .
[macro_use] extern crate tokio_trace;
None
fn main() {
let span = info_span!("my_great_span").

{
let _enter = span.enter().

this event occurs inside the span.
info!("i'm in the span!").

exiting the scope drops the guard, exiting the span.

this event is not inside the span.
info!("i'm outside the span!")
let span = info_span! ( " my_great_span " ) . { let _enter = span . enter () . this event occurs inside the span . info! ( " i ' m in the span! " ) . exiting the scope drops the guard exiting the span . this event is not inside the span . info! ( " i ' m outside the span! " )
}


[`Subscriber::enter`]: ../subscriber/trait.Subscriber.html#method.enter
[`Subscriber::exit`]: ../subscriber/trait.Subscriber.html#method.exit
[`Id`]: ../struct.Id.html
[ ` Subscriber :: enter ` ] : .. / subscriber / trait . Subscriber . html#method . enter [ ` Subscriber :: exit ` ] : .. / subscriber / trait . Subscriber . html#method . exit [ ` Id ` ] : .. / struct . Id . html