pub struct Context { /* private fields */ }Expand description
Per-invocation state, constructed from the dispatcher env contract.
Implementations§
Source§impl Context
impl Context
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Construct a Context by reading the documented READY_SET_* env vars.
Tolerates unset and unrecognized values per the env-vars contract.
Sourcepub const fn default_for_tests() -> Self
pub const fn default_for_tests() -> Self
Construct a default Context for tests or programmatic use.
Sourcepub const fn dispatcher_version(&self) -> Option<&Version>
pub const fn dispatcher_version(&self) -> Option<&Version>
Version of the dispatcher that invoked this plugin, if any.
Sourcepub fn project_root(&self) -> Option<&Path>
pub fn project_root(&self) -> Option<&Path>
Resolved project root, if any.
Sourcepub fn config_path(&self) -> Option<&Path>
pub fn config_path(&self) -> Option<&Path>
Resolved .ready-set.toml path, if any.
Sourcepub const fn output_mode(&self) -> OutputMode
pub const fn output_mode(&self) -> OutputMode
Requested output mode.
Sourcepub fn project_root_or_cwd(&self) -> Result<PathBuf>
pub fn project_root_or_cwd(&self) -> Result<PathBuf>
Return Self::project_root if known, otherwise cwd.
§Errors
Returns the underlying I/O error from std::env::current_dir if the
current working directory cannot be resolved.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnsafeUnpin for Context
impl UnwindSafe for Context
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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