Struct guppy::graph::Workspace

source ·
pub struct Workspace<'g> { /* private fields */ }
Expand description

Information about a workspace, parsed from metadata returned by cargo metadata.

For more about workspaces, see Cargo Workspaces in The Rust Programming Language.

Implementations§

source§

impl<'g> Workspace<'g>

These parallel iterators require the rayon1 feature is enabled.

source

pub fn par_iter(&self) -> impl ParallelIterator<Item = PackageMetadata<'g>>

Available on crate feature rayon1 only.

Returns a parallel iterator over package metadatas, sorted by workspace path.

Requires the rayon1 feature to be enabled.

source

pub fn par_iter_by_path( &self ) -> impl ParallelIterator<Item = (&'g Utf8Path, PackageMetadata<'g>)>

Available on crate feature rayon1 only.

Returns a parallel iterator over workspace paths and package metadatas, sorted by workspace paths.

Requires the rayon1 feature to be enabled.

source

pub fn par_iter_by_name( &self ) -> impl ParallelIterator<Item = (&'g str, PackageMetadata<'g>)>

Available on crate feature rayon1 only.

Returns a parallel iterator over workspace names and package metadatas, sorted by package names.

Requires the rayon1 feature to be enabled.

source§

impl<'g> Workspace<'g>

source

pub fn root(&self) -> &'g Utf8Path

Returns the workspace root.

source

pub fn target_directory(&self) -> &'g Utf8Path

Returns the target directory in which output artifacts are stored.

source

pub fn member_count(&self) -> usize

Returns the number of packages in this workspace.

source

pub fn contains_name(&self, name: impl AsRef<str>) -> bool

Returns true if the workspace contains a package by the given name.

source

pub fn contains_path(&self, path: impl AsRef<Utf8Path>) -> bool

Returns true if the workspace contains a package by the given workspace path.

source

pub fn iter( &self ) -> impl Iterator<Item = PackageMetadata<'g>> + ExactSizeIterator

Returns an iterator over package metadatas, sorted by the path they’re in.

source

pub fn iter_by_path( &self ) -> impl Iterator<Item = (&'g Utf8Path, PackageMetadata<'g>)> + ExactSizeIterator

Returns an iterator over workspace paths and package metadatas, sorted by the path they’re in.

source

pub fn iter_by_name( &self ) -> impl Iterator<Item = (&'g str, PackageMetadata<'g>)> + ExactSizeIterator

Returns an iterator over workspace names and package metadatas, sorted by names.

source

pub fn member_ids( &self ) -> impl Iterator<Item = &'g PackageId> + ExactSizeIterator

Returns an iterator over package IDs for workspace members. The package IDs will be returned in the same order as members, sorted by the path they’re in.

source

pub fn member_by_path( &self, path: impl AsRef<Utf8Path> ) -> Result<PackageMetadata<'g>, Error>

Maps the given path to the corresponding workspace member.

Returns an error if the path didn’t match any workspace members.

source

pub fn members_by_paths<B>( &self, paths: impl IntoIterator<Item = impl AsRef<Utf8Path>> ) -> Result<B, Error>

Maps the given paths to their corresponding workspace members, returning a new value of the specified collection type (e.g. Vec).

Returns an error if any of the paths were unknown.

source

pub fn member_by_name( &self, name: impl AsRef<str> ) -> Result<PackageMetadata<'g>, Error>

Maps the given name to the corresponding workspace member.

Returns an error if the name didn’t match any workspace members.

source

pub fn members_by_names<B>( &self, names: impl IntoIterator<Item = impl AsRef<str>> ) -> Result<B, Error>

Maps the given names to their corresponding workspace members, returning a new value of the specified collection type (e.g. Vec).

Returns an error if any of the paths were unknown.

source

pub fn metadata_table(&self) -> &'g JsonValue

Returns the freeform metadata table for this workspace.

This is the same as the workspace.metadata section of Cargo.toml. This section is typically used by tools which would like to store workspace configuration in Cargo.toml.

source§

impl<'g> Workspace<'g>

§Helpers for property testing

The methods in this section allow a Workspace to be used in property-based testing scenarios.

Currently, proptest 1 is supported if the proptest1 feature is enabled.

source

pub fn proptest1_name_strategy(&self) -> impl Strategy<Value = &'g str> + 'g

Available on crate feature proptest1 only.

Returns a Strategy that generates random package names from this workspace.

Requires the proptest1 feature to be enabled.

§Panics

Panics if there are no packages in this Workspace.

source

pub fn proptest1_id_strategy(&self) -> impl Strategy<Value = &'g PackageId> + 'g

Available on crate feature proptest1 only.

Returns a Strategy that generates random package IDs from this workspace.

Requires the proptest1 feature to be enabled.

§Panics

Panics if there are no packages in this Workspace.

Trait Implementations§

source§

impl<'g> Clone for Workspace<'g>

source§

fn clone(&self) -> Workspace<'g>

Returns a copy 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<'g> Debug for Workspace<'g>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'g> RefUnwindSafe for Workspace<'g>

§

impl<'g> Send for Workspace<'g>

§

impl<'g> Sync for Workspace<'g>

§

impl<'g> Unpin for Workspace<'g>

§

impl<'g> UnwindSafe for Workspace<'g>

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

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

§

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>,

§

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>,

§

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

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

§

fn vzip(self) -> V