pub struct CratesIoSpec {
pub package: String,
pub requirement: VersionReq,
}Expand description
A parsed crates.io:NAME@REQ source.
Fields§
§package: Stringcrates.io package name.
requirement: VersionReqVersion requirement applied to that package.
Implementations§
Source§impl CratesIoSpec
impl CratesIoSpec
Sourcepub fn new(
package: impl Into<String>,
requirement: VersionReq,
) -> Result<Self, CliError>
pub fn new( package: impl Into<String>, requirement: VersionReq, ) -> Result<Self, CliError>
Builds a spec from a package name and version requirement.
Returns an error when the package name is empty.
§Examples
use sim_run_core::CratesIoSpec;
let spec = CratesIoSpec::new("sim-codec-lisp", "^0.1".parse().unwrap()).unwrap();
assert_eq!(spec.package, "sim-codec-lisp");
assert!(CratesIoSpec::new("", "*".parse().unwrap()).is_err());Trait Implementations§
Source§impl Clone for CratesIoSpec
impl Clone for CratesIoSpec
Source§impl Debug for CratesIoSpec
impl Debug for CratesIoSpec
Source§impl Display for CratesIoSpec
impl Display for CratesIoSpec
impl Eq for CratesIoSpec
Source§impl FromStr for CratesIoSpec
impl FromStr for CratesIoSpec
Source§impl PartialEq for CratesIoSpec
impl PartialEq for CratesIoSpec
impl StructuralPartialEq for CratesIoSpec
Auto Trait Implementations§
impl Forget for CratesIoSpec
impl Freeze for CratesIoSpec
impl Move for CratesIoSpec
impl RefUnwindSafe for CratesIoSpec
impl Send for CratesIoSpec
impl Sync for CratesIoSpec
impl Unpin for CratesIoSpec
impl UnsafeUnpin for CratesIoSpec
impl UnwindSafe for CratesIoSpec
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.