pub enum ToolContract {
CliCommonBase,
Legacy {
supports_json: bool,
supports_doctor: bool,
},
}Expand description
Declares whether a tool has opted into the authoritative shared CLI contract.
Variants§
CliCommonBase
The tool exposes the full shared CLI contract.
Legacy
The tool still uses legacy advisory capability flags.
Implementations§
Source§impl ToolContract
impl ToolContract
Sourcepub const fn from_support_flags(
supports_json: bool,
supports_doctor: bool,
) -> Self
pub const fn from_support_flags( supports_json: bool, supports_doctor: bool, ) -> Self
Build a contract marker from legacy capability flags.
Sourcepub const fn supports_json(self) -> bool
pub const fn supports_json(self) -> bool
Whether the tool supports JSON output in base commands.
Sourcepub const fn supports_doctor(self) -> bool
pub const fn supports_doctor(self) -> bool
Whether the tool exposes doctor checks.
Whether the tool has opted into the authoritative shared CLI contract.
Sourcepub const fn validate(self) -> Result<(), ContractError>
pub const fn validate(self) -> Result<(), ContractError>
Validate that the tool has opted into the authoritative shared CLI contract.
§Errors
Returns ContractError::NotAuthoritative when the tool still relies on
legacy advisory capability flags.
Trait Implementations§
Source§impl Clone for ToolContract
impl Clone for ToolContract
Source§fn clone(&self) -> ToolContract
fn clone(&self) -> ToolContract
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ToolContract
Source§impl Debug for ToolContract
impl Debug for ToolContract
impl Eq for ToolContract
Source§impl PartialEq for ToolContract
impl PartialEq for ToolContract
Source§fn eq(&self, other: &ToolContract) -> bool
fn eq(&self, other: &ToolContract) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ToolContract
Auto Trait Implementations§
impl Freeze for ToolContract
impl RefUnwindSafe for ToolContract
impl Send for ToolContract
impl Sync for ToolContract
impl Unpin for ToolContract
impl UnsafeUnpin for ToolContract
impl UnwindSafe for ToolContract
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