pub struct Id(/* private fields */);
Expand description
A GraphQL ID
Any field in a GraphQL schema that has the type ID
should be represented
by this struct.
Implementations§
source§impl Id
impl Id
sourcepub fn new(s: impl Into<String>) -> Self
pub fn new(s: impl Into<String>) -> Self
Constructs an ID
from a String
, &str
or similar
cynic::Id::new("123");
sourcepub fn into_inner(self) -> String
pub fn into_inner(self) -> String
Converts this Id
into its inner value
sourcepub fn from_ref(s: &String) -> &Self
pub fn from_ref(s: &String) -> &Self
Converts a reference to a String to a reference to an Id
To be used when you can access an &String
which you want to assume is
an Id
for use in Cynic structures without reallocating
If you don’t have a String
at hand but only an &str
, you should know
that these can be used directly in InputObject
s as well when the
target GraphQL type is an Id
.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Id
impl<'de> Deserialize<'de> for Id
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
impl CoercesTo<Id> for Id
impl CoercesTo<Id> for str
impl CoercesTo<Option<Id>> for Id
impl CoercesTo<Option<Option<Id>>> for Id
impl CoercesTo<Option<Vec<Id>>> for Id
impl CoercesTo<Option<Vec<Option<Id>>>> for Id
impl CoercesTo<Vec<Id>> for Id
impl CoercesTo<Vec<Vec<Id>>> for Id
impl Eq for Id
impl StructuralPartialEq for Id
Auto Trait Implementations§
impl Freeze for Id
impl RefUnwindSafe for Id
impl Send for Id
impl Sync for Id
impl Unpin for Id
impl UnwindSafe for Id
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