pub struct Relationship {
pub data: Data<Identifier>,
pub links: Map<Key, Link>,
pub meta: Map,
/* private fields */
}
Expand description
Represents a resource’s relationship to another.
For more information, check out the relationships section of the JSON API specification.
Fields§
§data: Data<Identifier>
Contains resource linkage. For more information, checkout the resource linkage section of the JSON API specification.
links: Map<Key, Link>
Contains relevant links. If this value of this field is empty, it will not be serialized. For more information, check out the links section of the JSON API specification.
meta: Map
Non-standard meta information. If this value of this field is empty, it will not be serialized. For more information, check out the meta information section of the JSON API specification.
Implementations§
Source§impl Relationship
impl Relationship
Sourcepub fn new(data: Data<Identifier>) -> Self
pub fn new(data: Data<Identifier>) -> Self
Returns a new Relationship
.
§Example
use json_api::doc::{Data, Identifier, Relationship};
let ident = Identifier::new("users".parse()?, "1".to_owned());
let data = Data::Member(Box::new(Some(ident)));
let mut relationship = Relationship::new(data);
Trait Implementations§
Source§impl Clone for Relationship
impl Clone for Relationship
Source§fn clone(&self) -> Relationship
fn clone(&self) -> Relationship
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 Debug for Relationship
impl Debug for Relationship
Source§impl<'de> Deserialize<'de> for Relationship
impl<'de> Deserialize<'de> for Relationship
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
Source§impl From<Identifier> for Relationship
impl From<Identifier> for Relationship
Source§fn from(value: Identifier) -> Self
fn from(value: Identifier) -> Self
Converts to this type from the input type.
Source§impl From<Option<Identifier>> for Relationship
impl From<Option<Identifier>> for Relationship
Source§fn from(value: Option<Identifier>) -> Self
fn from(value: Option<Identifier>) -> Self
Converts to this type from the input type.
Source§impl From<Vec<Identifier>> for Relationship
impl From<Vec<Identifier>> for Relationship
Source§fn from(value: Vec<Identifier>) -> Self
fn from(value: Vec<Identifier>) -> Self
Converts to this type from the input type.
Source§impl FromIterator<Identifier> for Relationship
impl FromIterator<Identifier> for Relationship
Source§fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = Identifier>,
fn from_iter<I>(iter: I) -> Selfwhere
I: IntoIterator<Item = Identifier>,
Creates a value from an iterator. Read more
Source§impl PartialEq for Relationship
impl PartialEq for Relationship
Source§impl Serialize for Relationship
impl Serialize for Relationship
impl StructuralPartialEq for Relationship
Auto Trait Implementations§
impl Freeze for Relationship
impl RefUnwindSafe for Relationship
impl Send for Relationship
impl Sync for Relationship
impl Unpin for Relationship
impl UnwindSafe for Relationship
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