pub struct EcosystemToken(pub EcosystemId);Expand description
Wire-token wrapper for EcosystemId in JSON DTOs.
Serializes to the same id() string the pre-#1626 String field carried, and
deserializes through EcosystemId’s std::str::FromStr impl, so an unrecognized
token is rejected instead of accepted as an opaque string.
§Examples
use deps_cli::format::json::EcosystemToken;
use deps_core::EcosystemId;
let token = EcosystemToken(EcosystemId::Cargo);
assert_eq!(serde_json::to_string(&token).unwrap(), "\"cargo\"");
let parsed: EcosystemToken = serde_json::from_str("\"cargo\"").unwrap();
assert_eq!(parsed.0, EcosystemId::Cargo);Tuple Fields§
§0: EcosystemIdTrait Implementations§
Source§impl Clone for EcosystemToken
impl Clone for EcosystemToken
impl Copy for EcosystemToken
Source§impl Debug for EcosystemToken
impl Debug for EcosystemToken
Source§impl<'de> Deserialize<'de> for EcosystemToken
impl<'de> Deserialize<'de> for EcosystemToken
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Eq for EcosystemToken
Source§impl PartialEq for EcosystemToken
impl PartialEq for EcosystemToken
Source§impl Serialize for EcosystemToken
impl Serialize for EcosystemToken
impl StructuralPartialEq for EcosystemToken
Auto Trait Implementations§
impl Freeze for EcosystemToken
impl RefUnwindSafe for EcosystemToken
impl Send for EcosystemToken
impl Sync for EcosystemToken
impl Unpin for EcosystemToken
impl UnsafeUnpin for EcosystemToken
impl UnwindSafe for EcosystemToken
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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§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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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