pub struct Scope(/* private fields */);Expand description
The handle lent to the code that works under a running row.
Through a scope the work declares rows under that row
(child), asks whether the build is cancelled
(cancelled), and writes log lines
(log). It cannot start, count or end anything: the owner of
the row does that through its Task or Counted.
A scope is cheap to clone, so that a value that outlives a call can keep
one. Scope::none() is the scope of a build that reports nowhere; the
work calls the same methods on it, and each does nothing.
Implementations§
Source§impl Scope
impl Scope
Sourcepub fn none() -> Scope
pub fn none() -> Scope
The scope of a build that reports nowhere: it declares no row,
cancelled is false, and a log line goes
nowhere.
Sourcepub fn child(&self, kind: &Kind, label: Option<&str>) -> Pending
pub fn child(&self, kind: &Kind, label: Option<&str>) -> Pending
Declares a row of kind kind, labeled label, under this scope’s row,
and returns it, not started.
The returned handle has no row behind it, and does nothing, when this
scope has none, when the depth limit allows no row below this scope’s
row (Pending::with_depth_limit), or when this scope’s row has
ended.
The row declared stands for a part of this row’s work; under a row that has a count, it stands for one of the counted units, shown in detail, and the owner of the counted row advances it when that unit is done.
Sourcepub fn with_depth_limit(&self, levels: u32) -> Scope
pub fn with_depth_limit(&self, levels: u32) -> Scope
The same scope, with no more than levels levels of rows declared
below its row through it: 0 for none. A limit already in place that is
lower stays.
Sourcepub fn cancelled(&self) -> bool
pub fn cancelled(&self) -> bool
Whether the build was asked to stop.
The host’s checkpoint function is
called first, when it set one, and the flag is read after it. The work
asks at the grain of its units (once for a tree, an image, a formula),
not inside an inner loop. A build that was asked to stop produces
nothing from the step under way, so the work that sees true returns
as soon as it can, and what it returns need not be meaningful.
Sourcepub fn log_enabled(&self, level: LogLevel) -> bool
pub fn log_enabled(&self, level: LogLevel) -> bool
Whether the host’s log sink wants the lines of level: a caller tests
it before building the text of a line.
Sourcepub fn log(&self, level: LogLevel, text: &str)
pub fn log(&self, level: LogLevel, text: &str)
Writes the log line text at level to the host’s log sink.
The line is attributed to this scope’s row, or, for a scope past a depth limit, to the nearest row that exists: the record holds that row’s id and label, and the name of its kind as the source.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Scope
impl !UnwindSafe for Scope
impl Forget for Scope
impl Freeze for Scopewhere
*const ArcInner<Shared> is !null: Freeze,
PhantomData<ArcInner<Shared>>: Freeze,
*const ArcInner<Row> is !null: Freeze,
PhantomData<ArcInner<Row>>: Freeze,
impl Move for Scope
impl Send for Scope
impl Sync for Scope
impl Unpin for Scope
impl UnsafeUnpin for Scopewhere
*const ArcInner<Shared> is !null: UnsafeUnpin,
PhantomData<ArcInner<Shared>>: UnsafeUnpin,
*const ArcInner<Row> is !null: UnsafeUnpin,
PhantomData<ArcInner<Row>>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
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> ⓘ
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