pub struct ResourceObject<A: Attributes + Serialize + DeserializeOwned> {
pub id: Option<String>,
pub attributes: Option<A>,
pub relationships: Option<Relationships>,
pub links: Option<Links>,
pub meta: Option<Meta>,
}
Expand description
A resource object
Much like the object in the
JSON:API docs with the
notable difference that the type of the object is encoded into the strictly typed
Attributes
genric
Fields§
§id: Option<String>
The object identifier which together with A::kind
must identify
a unique resource
attributes: Option<A>
Attributes representing some of the resource’s data
relationships: Option<Relationships>
Describes relationships between this resource and others
links: Option<Links>
Contains links relating to the resource
meta: Option<Meta>
Contains non-standard meta information
Implementations§
Source§impl<A> ResourceObject<A>
impl<A> ResourceObject<A>
pub fn new(id: String, attributes: Option<A>) -> Self
Sourcepub fn add_relationship(&mut self, name: String, relationship: Relationship)
pub fn add_relationship(&mut self, name: String, relationship: Relationship)
Inserts an entry into the relationship map, creating the map if it does not exist
Trait Implementations§
Source§impl<A: Clone + Attributes + Serialize + DeserializeOwned> Clone for ResourceObject<A>
impl<A: Clone + Attributes + Serialize + DeserializeOwned> Clone for ResourceObject<A>
Source§fn clone(&self) -> ResourceObject<A>
fn clone(&self) -> ResourceObject<A>
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<A: Debug + Attributes + Serialize + DeserializeOwned> Debug for ResourceObject<A>
impl<A: Debug + Attributes + Serialize + DeserializeOwned> Debug for ResourceObject<A>
Source§impl<A> Default for ResourceObject<A>
impl<A> Default for ResourceObject<A>
Source§impl<A> From<&ResourceObject<A>> for GenericObject
impl<A> From<&ResourceObject<A>> for GenericObject
Source§fn from(ro: &ResourceObject<A>) -> Self
fn from(ro: &ResourceObject<A>) -> Self
Converts to this type from the input type.
Source§impl<A> From<ResourceObject<A>> for GenericObject
impl<A> From<ResourceObject<A>> for GenericObject
Source§fn from(ro: ResourceObject<A>) -> Self
fn from(ro: ResourceObject<A>) -> Self
Converts to this type from the input type.
Source§impl<A: PartialEq + Attributes + Serialize + DeserializeOwned> PartialEq for ResourceObject<A>
impl<A: PartialEq + Attributes + Serialize + DeserializeOwned> PartialEq for ResourceObject<A>
Source§impl<A> TryFrom<&GenericObject> for ResourceObject<A>
impl<A> TryFrom<&GenericObject> for ResourceObject<A>
Source§type Error = ObjectConversionError
type Error = ObjectConversionError
The type returned in the event of a conversion error.
Source§impl<A> TryFrom<&Identifier> for ResourceObject<A>
impl<A> TryFrom<&Identifier> for ResourceObject<A>
Source§type Error = ObjectConversionError
type Error = ObjectConversionError
The type returned in the event of a conversion error.
Source§impl<A> TryFrom<&ResourceObject<A>> for Identifier
impl<A> TryFrom<&ResourceObject<A>> for Identifier
Source§type Error = ObjectConversionError
type Error = ObjectConversionError
The type returned in the event of a conversion error.
Source§impl<A> TryFrom<GenericObject> for ResourceObject<A>
impl<A> TryFrom<GenericObject> for ResourceObject<A>
Source§type Error = ObjectConversionError
type Error = ObjectConversionError
The type returned in the event of a conversion error.
Source§impl<A> TryFrom<Identifier> for ResourceObject<A>
impl<A> TryFrom<Identifier> for ResourceObject<A>
Source§type Error = ObjectConversionError
type Error = ObjectConversionError
The type returned in the event of a conversion error.
Source§impl<A> TryFrom<ResourceObject<A>> for Identifier
impl<A> TryFrom<ResourceObject<A>> for Identifier
Source§type Error = ObjectConversionError
type Error = ObjectConversionError
The type returned in the event of a conversion error.
impl<A: Attributes + Serialize + DeserializeOwned> StructuralPartialEq for ResourceObject<A>
Auto Trait Implementations§
impl<A> Freeze for ResourceObject<A>where
A: Freeze,
impl<A> RefUnwindSafe for ResourceObject<A>where
A: RefUnwindSafe,
impl<A> Send for ResourceObject<A>where
A: Send,
impl<A> Sync for ResourceObject<A>where
A: Sync,
impl<A> Unpin for ResourceObject<A>where
A: Unpin,
impl<A> UnwindSafe for ResourceObject<A>where
A: UnwindSafe,
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