[][src]Struct df_st_api::api_objects::ApiItem

pub struct ApiItem<D> where
    D: ApiObject + Serialize + SchemaExample
{ pub type_: String, pub links: ApiItemLinks, pub data: D, pub base_url: String, }

A Wrapper for an ApiObject that includes additional metadata.

Fields

type_: String

A unique string identifier for this type.

links: ApiItemLinks

Links the various related items.

data: D

The included data item.

base_url: String

Server base url. Not included in response.

Implementations

impl<D> ApiItem<D> where
    D: ApiObject + Default + Serialize + SchemaExample
[src]

pub fn new(server_info: &State<'_, ServerInfo>) -> Self[src]

pub fn wrap(&mut self, item: D)[src]

Store the data in the object and construct links.

pub fn wrap_new(item: D, base_url: &str) -> ApiItem<D>[src]

Create and wrap the item. This is the same as doing:

This example is not tested
let api_item = ApiItem::wrap_new(result_item, &server_info.base_url);
// same as:
let api_item = ApiItem::new(server_info);
api_item.wrap(result_item);

Trait Implementations

impl<D: Clone> Clone for ApiItem<D> where
    D: ApiObject + Serialize + SchemaExample
[src]

impl<D: Debug> Debug for ApiItem<D> where
    D: ApiObject + Serialize + SchemaExample
[src]

impl<D: Default> Default for ApiItem<D> where
    D: ApiObject + Serialize + SchemaExample
[src]

impl<'de, D> Deserialize<'de> for ApiItem<D> where
    D: ApiObject + Serialize + SchemaExample,
    D: Deserialize<'de>, 
[src]

impl<D: JsonSchema> JsonSchema for ApiItem<D> where
    D: ApiObject + Serialize + SchemaExample
[src]

impl<D> SchemaExample for ApiItem<D> where
    D: SchemaExample + Serialize + ApiObject
[src]

impl<D> Serialize for ApiItem<D> where
    D: ApiObject + Serialize + SchemaExample,
    D: Serialize
[src]

Auto Trait Implementations

impl<D> RefUnwindSafe for ApiItem<D> where
    D: RefUnwindSafe

impl<D> Send for ApiItem<D> where
    D: Send

impl<D> Sync for ApiItem<D> where
    D: Sync

impl<D> Unpin for ApiItem<D> where
    D: Unpin

impl<D> UnwindSafe for ApiItem<D> where
    D: UnwindSafe

Blanket Implementations

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

impl<T, I> AsResult<T, I> for T where
    I: Input, 

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

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

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

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

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

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

impl<T> IntoCollection<T> for T

impl<T> IntoSql for T

impl<T> Same<T> for T

type Output = T

Should always be Self

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> Typeable for T where
    T: Any

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,