Struct nextest_metadata::RustBinaryId
source · pub struct RustBinaryId(/* private fields */);
Expand description
A unique identifier for a test suite (a Rust binary).
Implementations§
source§impl RustBinaryId
impl RustBinaryId
sourcepub fn from_parts(
package_name: &str,
kind: &RustTestBinaryKind,
target_name: &str,
) -> Self
pub fn from_parts( package_name: &str, kind: &RustTestBinaryKind, target_name: &str, ) -> Self
Creates a new RustBinaryId
from its constituent parts:
package_name
: The name of the package as defined inCargo.toml
.kind
: The kind of the target (seeRustTestBinaryKind
).target_name
: The name of the target.
The algorithm is as follows:
- If the kind is
lib
orproc-macro
(i.e. for unit tests), the binary ID is the same as the package name. There can only be one library per package, so this will always be unique. - If the target is an integration test, the binary ID is
package_name::target_name
. - Otherwise, the binary ID is
package_name::{kind}/{target_name}
.
This format is part of nextest’s stable API.
§Examples
use nextest_metadata::{RustBinaryId, RustTestBinaryKind};
// The lib and proc-macro kinds.
assert_eq!(
RustBinaryId::from_parts("foo-lib", &RustTestBinaryKind::LIB, "foo_lib"),
RustBinaryId::new("foo-lib"),
);
assert_eq!(
RustBinaryId::from_parts("foo-derive", &RustTestBinaryKind::PROC_MACRO, "derive"),
RustBinaryId::new("foo-derive"),
);
// Integration tests.
assert_eq!(
RustBinaryId::from_parts("foo-lib", &RustTestBinaryKind::TEST, "foo_test"),
RustBinaryId::new("foo-lib::foo_test"),
);
// Other kinds.
assert_eq!(
RustBinaryId::from_parts("foo-lib", &RustTestBinaryKind::BIN, "foo_bin"),
RustBinaryId::new("foo-lib::bin/foo_bin"),
);
sourcepub fn components(&self) -> RustBinaryIdComponents<'_>
pub fn components(&self) -> RustBinaryIdComponents<'_>
Returns the components of this identifier.
Trait Implementations§
source§impl Clone for RustBinaryId
impl Clone for RustBinaryId
source§fn clone(&self) -> RustBinaryId
fn clone(&self) -> RustBinaryId
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for RustBinaryId
impl Debug for RustBinaryId
source§impl<'de> Deserialize<'de> for RustBinaryId
impl<'de> Deserialize<'de> for RustBinaryId
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Display for RustBinaryId
impl Display for RustBinaryId
source§impl<S> From<S> for RustBinaryId
impl<S> From<S> for RustBinaryId
source§impl Hash for RustBinaryId
impl Hash for RustBinaryId
source§impl Ord for RustBinaryId
impl Ord for RustBinaryId
source§fn cmp(&self, other: &RustBinaryId) -> Ordering
fn cmp(&self, other: &RustBinaryId) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for RustBinaryId
impl PartialEq for RustBinaryId
source§fn eq(&self, other: &RustBinaryId) -> bool
fn eq(&self, other: &RustBinaryId) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for RustBinaryId
impl PartialOrd for RustBinaryId
source§fn partial_cmp(&self, other: &RustBinaryId) -> Option<Ordering>
fn partial_cmp(&self, other: &RustBinaryId) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for RustBinaryId
impl Serialize for RustBinaryId
impl Eq for RustBinaryId
impl StructuralPartialEq for RustBinaryId
Auto Trait Implementations§
impl Freeze for RustBinaryId
impl RefUnwindSafe for RustBinaryId
impl Send for RustBinaryId
impl Sync for RustBinaryId
impl Unpin for RustBinaryId
impl UnwindSafe for RustBinaryId
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)