[][src]Struct japi::ResourceObject

pub struct ResourceObject<A: Attributes + Serialize + DeserializeOwned> {
    pub id: String,
    pub attributes: Option<A>,
    pub relationships: Option<Relationships>,
    pub links: Option<Links>,
    pub meta: Option<Meta>,
}

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: 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

Methods

impl<A> ResourceObject<A> where
    A: Attributes + Serialize + DeserializeOwned
[src]

pub fn new(id: String, attributes: Option<A>) -> Self[src]

pub fn add_relationship(&mut self, name: String, relationship: Relationship)[src]

Inserts an entry into the relationship map, creating the map if it does not exist

Inserts an entry into the link map, creating the map if it does not exist

Trait Implementations

impl<A> From<ResourceObject<A>> for GenericObject where
    A: Attributes + SerializeTrait + DeserializeOwned
[src]

impl<'_, A> From<&'_ ResourceObject<A>> for GenericObject where
    A: Attributes + SerializeTrait + DeserializeOwned
[src]

impl<A> From<ResourceObject<A>> for Identifier where
    A: Attributes + SerializeTrait + DeserializeOwned
[src]

impl<'_, A> From<&'_ ResourceObject<A>> for Identifier where
    A: Attributes + SerializeTrait + DeserializeOwned
[src]

impl<A: Clone + Attributes + Serialize + DeserializeOwned> Clone for ResourceObject<A>[src]

impl<A: PartialEq + Attributes + Serialize + DeserializeOwned> PartialEq<ResourceObject<A>> for ResourceObject<A>[src]

impl<A: Debug + Attributes + Serialize + DeserializeOwned> Debug for ResourceObject<A>[src]

impl<A> TryFrom<GenericObject> for ResourceObject<A> where
    A: Attributes + Serialize + DeserializeOwned
[src]

type Error = ObjectConversionError

The type returned in the event of a conversion error.

impl<'_, A> TryFrom<&'_ GenericObject> for ResourceObject<A> where
    A: Attributes + Serialize + DeserializeOwned
[src]

type Error = ObjectConversionError

The type returned in the event of a conversion error.

impl<A> TryFrom<Identifier> for ResourceObject<A> where
    A: Attributes + Serialize + DeserializeOwned
[src]

type Error = ObjectConversionError

The type returned in the event of a conversion error.

impl<'_, A> TryFrom<&'_ Identifier> for ResourceObject<A> where
    A: Attributes + Serialize + DeserializeOwned
[src]

type Error = ObjectConversionError

The type returned in the event of a conversion error.

Auto Trait Implementations

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

impl<A> RefUnwindSafe for ResourceObject<A> where
    A: RefUnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]