Struct CrateHandle

Source
pub struct CrateHandle { /* private fields */ }

Implementations§

Source§

impl CrateHandle

Source

pub fn crate_path(&self) -> &PathBuf

Source

pub fn cargo_toml_handle(&self) -> &Arc<Mutex<CargoToml>>

Source§

impl CrateHandle

Source

pub fn new_sync<P>(crate_path: &P) -> Result<CrateHandle, CrateError>
where P: for<'async_trait> HasCargoTomlPathBuf + for<'async_trait> HasCargoTomlPathBufSync + for<'async_trait> AsRef<Path> + for<'async_trait> Send + for<'async_trait> Sync + 'async_trait, CrateError: From<<P as HasCargoTomlPathBuf>::Error> + From<<P as HasCargoTomlPathBufSync>::Error>,

Initializes a crate handle from a given crate_path

Source§

impl CrateHandle

Source

pub fn cargo_toml_direct(&self) -> Arc<Mutex<CargoToml>>

sometimes we need to do this, but do try not to

Trait Implementations§

Source§

impl ApplyAiReadmeOutput for CrateHandle

Source§

type Error = CrateError

Source§

fn update_readme_md<'life0, 'life1, 'async_trait>( &'life0 self, new_contents: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), <CrateHandle as ApplyAiReadmeOutput>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, CrateHandle: 'async_trait,

Updates the local README.md with the given text.
Source§

fn update_cargo_toml<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, new_description: &'life1 str, new_keywords: &'life2 [String], new_categories: &'life3 [String], ) -> Pin<Box<dyn Future<Output = Result<(), <CrateHandle as ApplyAiReadmeOutput>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, CrateHandle: 'async_trait,

Updates the Cargo.toml fields, e.g. description, keywords, categories, etc.
Source§

impl AsRef<Path> for CrateHandle

Source§

fn as_ref(&self) -> &Path

Allows CrateHandle to be used as a path by referencing crate_path

Source§

impl<P> AsyncTryFrom<P> for CrateHandle
where P: for<'async_trait> HasCargoTomlPathBuf + for<'async_trait> HasCargoTomlPathBufSync + for<'async_trait> AsRef<Path> + for<'async_trait> Send + for<'async_trait> Sync + 'async_trait, CrateError: From<<P as HasCargoTomlPathBuf>::Error> + From<<P as HasCargoTomlPathBufSync>::Error>,

Source§

fn new<'life0, 'async_trait>( crate_path: &'life0 P, ) -> Pin<Box<dyn Future<Output = Result<CrateHandle, <CrateHandle as AsyncTryFrom<P>>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, CrateHandle: 'async_trait,

Initializes a crate handle from a given crate_path

Source§

type Error = CrateError

Source§

impl CheckIfReadmeExists for CrateHandle

Source§

fn check_readme_exists(&self) -> Result<(), CrateError>

Checks if README.md exists

Source§

impl CheckIfSrcDirectoryContainsValidFiles for CrateHandle

Source§

fn check_src_directory_contains_valid_files(&self) -> Result<(), CrateError>

Checks if the src/ directory contains a lib.rs or main.rs

Source§

impl CleanupCrate for CrateHandle

Source§

fn cleanup_crate<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, CrateHandle: 'async_trait,

Source§

impl Clone for CrateHandle

Source§

fn clone(&self) -> CrateHandle

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CrateHandle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CrateHandle

Source§

fn deserialize<D>( deserializer: D, ) -> Result<CrateHandle, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl EnsureAllSourceFilesAreRegistered for CrateHandle

Source§

type Error = SourceFileRegistrationError

Source§

fn ensure_all_source_files_are_registered<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), <CrateHandle as EnsureAllSourceFilesAreRegistered>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, CrateHandle: 'async_trait,

Source§

impl EnsureGitClean for CrateHandle

Source§

type Error = GitError

Source§

fn ensure_git_clean<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), <CrateHandle as EnsureGitClean>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, CrateHandle: 'async_trait,

Source§

impl GatherBinTargetNames for CrateHandle

Source§

type Error = CrateError

Source§

fn gather_bin_target_names<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, <CrateHandle as GatherBinTargetNames>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, CrateHandle: 'async_trait,

Source§

impl GetCargoMetadata for CrateHandle

  1. For single crates (CrateHandle), we do a similar approach, but we run cargo metadata from that crate’s directory (the parent of Cargo.toml), or pass --manifest-path if you prefer.
Source§

type Error = CrateError

Source§

fn get_cargo_metadata<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Metadata, <CrateHandle as GetCargoMetadata>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, CrateHandle: 'async_trait,

Source§

impl GetFilesInDirectory for CrateHandle

Source§

fn get_files_in_dir<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dir_name: &'life1 str, extension: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<PathBuf>, CrateError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, CrateHandle: 'async_trait,

Asynchronously returns a list of files with the given extension in the specified directory

Source§

impl GetFilesInDirectoryWithExclusions for CrateHandle

Source§

fn get_files_in_dir_with_exclusions<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, dir_name: &'life1 str, extension: &'life2 str, exclude_files: &'life3 [&'life4 str], ) -> Pin<Box<dyn Future<Output = Result<Vec<PathBuf>, CrateError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, CrateHandle: 'async_trait,

Asynchronously returns a list of files with the given extension in the specified directory, excluding specified file names.

Source§

impl GetInternalDependencies for CrateHandle

Source§

fn internal_dependencies<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, CrateError>> + Send + 'async_trait>>
where 'life0: 'async_trait, CrateHandle: 'async_trait,

Gathers all [dependencies] entries that have path = "../some-other-crate". Returns their names as used in the Cargo.toml [dependencies] table key.
Source§

impl GetReadmePath for CrateHandle

Source§

fn readme_path<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<PathBuf>, CrateError>> + Send + 'async_trait>>
where 'life0: 'async_trait, CrateHandle: 'async_trait,

Asynchronously returns the path to the README.md if it exists

Source§

impl GetSourceFilesWithExclusions for CrateHandle

Source§

fn source_files_excluding<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, exclude_files: &'life1 [&'life2 str], ) -> Pin<Box<dyn Future<Output = Result<Vec<PathBuf>, CrateError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, CrateHandle: 'async_trait,

Asynchronously returns a list of source files (.rs) in the src/ directory, excluding specified files

Source§

impl GetTestFiles for CrateHandle

Source§

fn test_files<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<PathBuf>, CrateError>> + Send + 'async_trait>>
where 'life0: 'async_trait, CrateHandle: 'async_trait,

Asynchronously returns a list of test files (.rs) in the tests/ directory

Source§

impl HasCargoToml for CrateHandle

Source§

fn cargo_toml( &self, ) -> Arc<Mutex<dyn CargoTomlInterface<Error = CargoTomlError, Error = CargoTomlError, Error = CargoTomlError, Error = CargoTomlError, Error = CargoTomlError, Error = CargoTomlError, Error = CargoTomlError, Error = CargoTomlError, Error = CargoTomlError, Error = CargoTomlError, Error = CargoTomlError, Error = CargoTomlError, Error = CargoTomlError, Error = CargoTomlError, Error = CargoTomlError, Error = CargoTomlError, Error = CargoTomlError, Error = CargoTomlError, Error = CargoTomlError, Error = CargoTomlError, Error = CargoTomlError, Error = CargoTomlError>>>

Source§

impl HasTestsDirectory for CrateHandle

Source§

impl IsPrivate for CrateHandle

Source§

fn is_private<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<bool, <CrateHandle as IsPrivate>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, CrateHandle: 'async_trait,

Checks if the crate is private by reading the ‘publish’ field or ‘publish = false’ or ‘package.publish = false’ in Cargo.toml. Returns Ok(true) if private, Ok(false) if not private.

Source§

type Error = CrateError

Source§

impl NameAllFiles for CrateHandle

Source§

fn name_all_files<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), <CrateHandle as NameAllFiles>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, CrateHandle: 'async_trait,

Removes old marker lines in .rs files of this crate, then inserts one new marker line.

Old markers removed:

  1. Lines with 6+ dashes plus [ File: ... ] e.g. // -------------- [ File: path.rs ]

  2. Lines that exactly match // old marker (case-sensitive).

After removal, it prepends: // ---------------- [ File: relative/path.rs ]

The relative path is path.strip_prefix(self.as_ref()) where possible.

Source§

type Error = CrateError

Source§

impl Named for CrateHandle

Source§

fn name(&self) -> Cow<'_, str>

Returns the name associated with self. We use Cow to allow both owned and borrowed strings.
Source§

impl PinAllWildcardDependencies for CrateHandle

Source§

type Error = CrateError

Source§

fn pin_all_wildcard_dependencies<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), <CrateHandle as PinAllWildcardDependencies>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, CrateHandle: 'async_trait,

Source§

impl PinWildcardDependencies for CrateHandle

Source§

type Error = CrateError

Source§

fn pin_wildcard_dependencies<'life0, 'life1, 'async_trait>( &'life0 mut self, lock_versions: &'life1 BTreeMap<String, BTreeSet<Version>>, ) -> Pin<Box<dyn Future<Output = Result<(), CrateError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, CrateHandle: 'async_trait,

Source§

impl ReadFileString for CrateHandle

Source§

fn read_file_string<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 Path, ) -> Pin<Box<dyn Future<Output = Result<String, CrateError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, CrateHandle: 'async_trait,

Source§

impl ReadyForCargoPublish for CrateHandle

Source§

fn ready_for_cargo_publish<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), <CrateHandle as ReadyForCargoPublish>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, CrateHandle: 'async_trait,

Checks if the crate is ready for Cargo publishing

Source§

type Error = CrateError

Source§

impl RebuildOrTest for CrateHandle

Source§

fn rebuild_or_test<'life0, 'life1, 'async_trait>( &'life0 self, runner: &'life1 dyn CommandRunner, ) -> Pin<Box<dyn Future<Output = Result<(), <CrateHandle as RebuildOrTest>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, CrateHandle: 'async_trait,

Runs cargo build and then cargo test in this crate’s directory. Logs success or error details; returns Ok(()) if both succeed.

Source§

type Error = CrateError

Source§

impl RunLinting for CrateHandle

Now do not implement RunLinting in a generic way for all C: CrateHandleInterface. Instead, implement it for your actual concrete crate type—for example, CrateHandle.

That ensures there is no overlap with Workspace<P,H> in the compiler’s eyes.

Source§

type Report = LintReport

Source§

type Error = LintingError

Source§

fn run_linting<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<<CrateHandle as RunLinting>::Report, <CrateHandle as RunLinting>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, CrateHandle: 'async_trait,

Source§

impl RunTestsWithCoverage for CrateHandle

Source§

type Report = TestCoverageReport

Source§

type Error = WorkspaceError

Source§

fn run_tests_with_coverage<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<<CrateHandle as RunTestsWithCoverage>::Report, <CrateHandle as RunTestsWithCoverage>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, CrateHandle: 'async_trait,

Source§

impl Serialize for CrateHandle

Source§

fn serialize<S>( &self, serializer: S, ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl SortAndFormatImports for CrateHandle

Source§

type Error = CrateError

Source§

fn sort_and_format_imports<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), <CrateHandle as SortAndFormatImports>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, CrateHandle: 'async_trait,

Sorts & formats the imports for either a single crate or an entire workspace.
Source§

impl TopologicalSortInternalDeps for CrateHandle

Source§

fn topological_sort_internal_deps<'life0, 'life1, 'async_trait>( &'life0 self, config: &'life1 TopologicalSortConfig, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, CrateHandle: 'async_trait,

Returns a flat topological ordering of all internal dependencies leading up to (and including) this crate.
Source§

fn layered_topological_order_upto_self<'life0, 'life1, 'async_trait>( &'life0 self, config: &'life1 TopologicalSortConfig, ) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<String>>, WorkspaceError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, CrateHandle: 'async_trait,

Returns a layered topological ordering of all internal dependencies up to this crate.
Source§

impl TryPublish for CrateHandle

Source§

type Error = CrateError

Source§

fn try_publish<'life0, 'async_trait>( &'life0 self, dry_run: bool, ) -> Pin<Box<dyn Future<Output = Result<(), <CrateHandle as TryPublish>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, CrateHandle: 'async_trait,

Source§

impl UpdateReadmeFiles for CrateHandle

Source§

type Error = AiReadmeWriterError

Source§

fn update_readme_files<'life0, 'async_trait>( crate_handle: Arc<Mutex<CrateHandle>>, plant: bool, force: bool, config: &'life0 ReadmeWriterConfig, ) -> Pin<Box<dyn Future<Output = Result<(), <CrateHandle as UpdateReadmeFiles>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, CrateHandle: 'async_trait,

Orchestrates the steps to generate queries, call the AI, and update README(s). The force parameter means: if false, skip crates/workspaces that already have a README. The config carries user preferences (docs/fn-bodies/test-items/etc.) for readme generation.
Source§

impl ValidateIntegrity for CrateHandle

Source§

type Error = CrateError

Source§

fn validate_integrity<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), <CrateHandle as ValidateIntegrity>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, CrateHandle: 'async_trait,

Source§

impl VerifyCrateIsNotPrivate for CrateHandle

Source§

type Error = CrateError

Source§

fn verify_crate_is_not_private<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), <CrateHandle as VerifyCrateIsNotPrivate>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, CrateHandle: 'async_trait,

Source§

impl VerifyCrateVersionIsNotYetPublishedOnCratesIo for CrateHandle

Source§

type Error = CrateError

Source§

fn verify_crate_version_is_not_yet_published_on_crates_io<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), <CrateHandle as VerifyCrateVersionIsNotYetPublishedOnCratesIo>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, CrateHandle: 'async_trait,

Source§

impl Versioned for CrateHandle

Source§

impl WatchAndReload for CrateHandle

Source§

fn watch_and_reload<'a, 'life0, 'async_trait>( &'life0 self, tx: Option<Sender<Result<(), <CrateHandle as WatchAndReload>::Error>>>, runner: Arc<dyn CommandRunner + Send + Sync + 'a>, cancel_token: CancellationToken, ) -> Pin<Box<dyn Future<Output = Result<(), <CrateHandle as WatchAndReload>::Error>> + Send + 'async_trait>>
where 'a: 'async_trait, 'life0: 'async_trait, CrateHandle: 'async_trait,

Sets up file-watching for this one crate, then enters a watch loop until cancel_token is triggered. Triggers rebuild/test whenever a relevant change is detected.

Source§

fn is_relevant_change<'life0, 'life1, 'async_trait>( &'life0 self, path: &'life1 Path, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, CrateHandle: 'async_trait,

A change is considered “relevant” if it’s Cargo.toml or in src/

Source§

type Error = CrateError

Source§

impl<P> CrateHandleInterface<P> for CrateHandle
where P: for<'async_trait> HasCargoTomlPathBuf + for<'async_trait> HasCargoTomlPathBufSync + for<'async_trait> AsRef<Path> + for<'async_trait> Send + for<'async_trait> Sync + 'async_trait, CrateError: From<<P as HasCargoTomlPathBuf>::Error> + From<<P as HasCargoTomlPathBufSync>::Error>,

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Bump for T

Source§

type Error = CrateError

Source§

fn bump<'life0, 'async_trait>( &'life0 mut self, release: ReleaseType, ) -> Pin<Box<dyn Future<Output = Result<(), <T as Bump>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, T: 'async_trait,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ConsolidateCrateInterface for T

Source§

fn consolidate_crate_interface<'life0, 'life1, 'async_trait>( &'life0 self, options: &'life1 ConsolidationOptions, ) -> Pin<Box<dyn Future<Output = Result<ConsolidatedCrateInterface, CrateError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, T: 'async_trait,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> GetFileSize for T
where T: AsRef<Path> + Send + Sync,

Source§

fn file_size<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u64, FileError>> + Send + 'async_trait>>
where 'life0: 'async_trait, T: 'async_trait,

Source§

impl<T> GetTargetPathForAIExpansion for T
where T: Named,

Source§

fn target_path_for_ai_json_expansion( &self, target_dir: &Path, _expected_content_type: &ExpectedContentType, ) -> PathBuf

Source§

impl<T> GetVersionOfLocalDep for T
where T: Send + Sync + AsRef<Path>,

Source§

fn version_of_local_dep<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, dep_name: &'life1 str, dep_path: &'life2 str, ) -> Pin<Box<dyn Future<Output = Option<String>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, T: 'async_trait,

Source§

impl<P> HasCargoTomlPathBuf for P
where P: for<'async_trait> AsRef<Path> + for<'async_trait> Send + for<'async_trait> Sync + 'async_trait,

Source§

fn cargo_toml_path_buf<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<PathBuf, <P as HasCargoTomlPathBuf>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, P: 'async_trait,

Asynchronously returns the path to the Cargo.toml

Source§

type Error = CrateError

Source§

impl<P> HasCargoTomlPathBufSync for P
where P: AsRef<Path>,

Source§

fn cargo_toml_path_buf_sync( &self, ) -> Result<PathBuf, <P as HasCargoTomlPathBufSync>::Error>

Asynchronously returns the path to the Cargo.toml

Source§

type Error = CrateError

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoBox<dyn Any> for T
where T: Any,

Source§

fn into_box(self) -> Box<dyn Any>

Convert self into the appropriate boxed form.
Source§

impl<T> IntoBox<dyn Any + Send> for T
where T: Any + Send,

Source§

fn into_box(self) -> Box<dyn Any + Send>

Convert self into the appropriate boxed form.
Source§

impl<T> IntoBox<dyn Any + Send + Sync> for T
where T: Any + Send + Sync,

Source§

fn into_box(self) -> Box<dyn Any + Send + Sync>

Convert self into the appropriate boxed form.
Source§

impl<T> IntoCollection<T> for T

Source§

fn into_collection<A>(self) -> SmallVec<A>
where A: Array<Item = T>,

Converts self into a collection.
Source§

fn mapped<U, F, A>(self, f: F) -> SmallVec<A>
where F: FnMut(T) -> U, A: Array<Item = U>,

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Paint for T
where T: ?Sized,

Source§

fn fg(&self, value: Color) -> Painted<&T>

Returns a styled value derived from self with the foreground set to value.

This method should be used rarely. Instead, prefer to use color-specific builder methods like red() and green(), which have the same functionality but are pithier.

§Example

Set foreground color to white using fg():

use yansi::{Paint, Color};

painted.fg(Color::White);

Set foreground color to white using white().

use yansi::Paint;

painted.white();
Source§

fn primary(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Primary].

§Example
println!("{}", value.primary());
Source§

fn fixed(&self, color: u8) -> Painted<&T>

Returns self with the fg() set to [Color :: Fixed].

§Example
println!("{}", value.fixed(color));
Source§

fn rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the fg() set to [Color :: Rgb].

§Example
println!("{}", value.rgb(r, g, b));
Source§

fn black(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Black].

§Example
println!("{}", value.black());
Source§

fn red(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Red].

§Example
println!("{}", value.red());
Source§

fn green(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Green].

§Example
println!("{}", value.green());
Source§

fn yellow(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Yellow].

§Example
println!("{}", value.yellow());
Source§

fn blue(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Blue].

§Example
println!("{}", value.blue());
Source§

fn magenta(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Magenta].

§Example
println!("{}", value.magenta());
Source§

fn cyan(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: Cyan].

§Example
println!("{}", value.cyan());
Source§

fn white(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: White].

§Example
println!("{}", value.white());
Source§

fn bright_black(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightBlack].

§Example
println!("{}", value.bright_black());
Source§

fn bright_red(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightRed].

§Example
println!("{}", value.bright_red());
Source§

fn bright_green(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightGreen].

§Example
println!("{}", value.bright_green());
Source§

fn bright_yellow(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightYellow].

§Example
println!("{}", value.bright_yellow());
Source§

fn bright_blue(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightBlue].

§Example
println!("{}", value.bright_blue());
Source§

fn bright_magenta(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightMagenta].

§Example
println!("{}", value.bright_magenta());
Source§

fn bright_cyan(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightCyan].

§Example
println!("{}", value.bright_cyan());
Source§

fn bright_white(&self) -> Painted<&T>

Returns self with the fg() set to [Color :: BrightWhite].

§Example
println!("{}", value.bright_white());
Source§

fn bg(&self, value: Color) -> Painted<&T>

Returns a styled value derived from self with the background set to value.

This method should be used rarely. Instead, prefer to use color-specific builder methods like on_red() and on_green(), which have the same functionality but are pithier.

§Example

Set background color to red using fg():

use yansi::{Paint, Color};

painted.bg(Color::Red);

Set background color to red using on_red().

use yansi::Paint;

painted.on_red();
Source§

fn on_primary(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Primary].

§Example
println!("{}", value.on_primary());
Source§

fn on_fixed(&self, color: u8) -> Painted<&T>

Returns self with the bg() set to [Color :: Fixed].

§Example
println!("{}", value.on_fixed(color));
Source§

fn on_rgb(&self, r: u8, g: u8, b: u8) -> Painted<&T>

Returns self with the bg() set to [Color :: Rgb].

§Example
println!("{}", value.on_rgb(r, g, b));
Source§

fn on_black(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Black].

§Example
println!("{}", value.on_black());
Source§

fn on_red(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Red].

§Example
println!("{}", value.on_red());
Source§

fn on_green(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Green].

§Example
println!("{}", value.on_green());
Source§

fn on_yellow(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Yellow].

§Example
println!("{}", value.on_yellow());
Source§

fn on_blue(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Blue].

§Example
println!("{}", value.on_blue());
Source§

fn on_magenta(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Magenta].

§Example
println!("{}", value.on_magenta());
Source§

fn on_cyan(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: Cyan].

§Example
println!("{}", value.on_cyan());
Source§

fn on_white(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: White].

§Example
println!("{}", value.on_white());
Source§

fn on_bright_black(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightBlack].

§Example
println!("{}", value.on_bright_black());
Source§

fn on_bright_red(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightRed].

§Example
println!("{}", value.on_bright_red());
Source§

fn on_bright_green(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightGreen].

§Example
println!("{}", value.on_bright_green());
Source§

fn on_bright_yellow(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightYellow].

§Example
println!("{}", value.on_bright_yellow());
Source§

fn on_bright_blue(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightBlue].

§Example
println!("{}", value.on_bright_blue());
Source§

fn on_bright_magenta(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightMagenta].

§Example
println!("{}", value.on_bright_magenta());
Source§

fn on_bright_cyan(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightCyan].

§Example
println!("{}", value.on_bright_cyan());
Source§

fn on_bright_white(&self) -> Painted<&T>

Returns self with the bg() set to [Color :: BrightWhite].

§Example
println!("{}", value.on_bright_white());
Source§

fn attr(&self, value: Attribute) -> Painted<&T>

Enables the styling Attribute value.

This method should be used rarely. Instead, prefer to use attribute-specific builder methods like bold() and underline(), which have the same functionality but are pithier.

§Example

Make text bold using attr():

use yansi::{Paint, Attribute};

painted.attr(Attribute::Bold);

Make text bold using using bold().

use yansi::Paint;

painted.bold();
Source§

fn bold(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Bold].

§Example
println!("{}", value.bold());
Source§

fn dim(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Dim].

§Example
println!("{}", value.dim());
Source§

fn italic(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Italic].

§Example
println!("{}", value.italic());
Source§

fn underline(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Underline].

§Example
println!("{}", value.underline());

Returns self with the attr() set to [Attribute :: Blink].

§Example
println!("{}", value.blink());

Returns self with the attr() set to [Attribute :: RapidBlink].

§Example
println!("{}", value.rapid_blink());
Source§

fn invert(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Invert].

§Example
println!("{}", value.invert());
Source§

fn conceal(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Conceal].

§Example
println!("{}", value.conceal());
Source§

fn strike(&self) -> Painted<&T>

Returns self with the attr() set to [Attribute :: Strike].

§Example
println!("{}", value.strike());
Source§

fn quirk(&self, value: Quirk) -> Painted<&T>

Enables the yansi Quirk value.

This method should be used rarely. Instead, prefer to use quirk-specific builder methods like mask() and wrap(), which have the same functionality but are pithier.

§Example

Enable wrapping using .quirk():

use yansi::{Paint, Quirk};

painted.quirk(Quirk::Wrap);

Enable wrapping using wrap().

use yansi::Paint;

painted.wrap();
Source§

fn mask(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Mask].

§Example
println!("{}", value.mask());
Source§

fn wrap(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Wrap].

§Example
println!("{}", value.wrap());
Source§

fn linger(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Linger].

§Example
println!("{}", value.linger());
Source§

fn clear(&self) -> Painted<&T>

👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear(). The clear() method will be removed in a future release.

Returns self with the quirk() set to [Quirk :: Clear].

§Example
println!("{}", value.clear());
Source§

fn resetting(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Resetting].

§Example
println!("{}", value.resetting());
Source§

fn bright(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: Bright].

§Example
println!("{}", value.bright());
Source§

fn on_bright(&self) -> Painted<&T>

Returns self with the quirk() set to [Quirk :: OnBright].

§Example
println!("{}", value.on_bright());
Source§

fn whenever(&self, value: Condition) -> Painted<&T>

Conditionally enable styling based on whether the Condition value applies. Replaces any previous condition.

See the crate level docs for more details.

§Example

Enable styling painted only when both stdout and stderr are TTYs:

use yansi::{Paint, Condition};

painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);
Source§

fn new(self) -> Painted<Self>
where Self: Sized,

Create a new Painted with a default Style. Read more
Source§

fn paint<S>(&self, style: S) -> Painted<&Self>
where S: Into<Style>,

Apply a style wholesale to self. Any previous style is replaced. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> PruneInvalidCategorySlugs for T

Source§

type Error = CrateError

Source§

fn prune_invalid_category_slugs<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<usize, <T as PruneInvalidCategorySlugs>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, T: 'async_trait,

Source§

impl<P> RootDirPathBuf for P
where P: AsRef<Path> + Send + Sync,

Source§

fn root_dir_path_buf(&self) -> PathBuf

returns the path to the Cargo.toml

Source§

impl<T> ShowItem for T

Source§

type Error = CrateError

Source§

fn show<'life0, 'life1, 'async_trait>( &'life0 self, options: &'life1 ShowFlags, ) -> Pin<Box<dyn Future<Output = Result<String, <T as ShowItem>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, T: 'async_trait,

Render crate info (and optional crate-tree info) to a textual output.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<P, T> ReadmeWritingCrateHandle<P> for T
where T: CrateHandleInterface<P> + ApplyAiReadmeOutput<Error = CrateError> + ConsolidateCrateInterface + Send + Sync + Debug + 'static, P: AsRef<Path> + Send + Sync + 'static,