Skip to main content

Collection

Struct Collection 

Source
pub struct Collection {
Show 14 fields pub subject: String, pub property: Option<String>, pub value: Option<String>, pub members: Vec<String>, pub members_nested: Option<Vec<Resource>>, pub sort_by: Option<String>, pub sort_desc: bool, pub page_size: usize, pub current_page: usize, pub total_items: usize, pub total_pages: usize, pub name: Option<String>, pub include_nested: bool, pub include_external: bool,
}
Expand description

Dynamic resource used for ordering, filtering and querying content. Contains members / results. Use CollectionBuilder if you don’t (yet) need the results. Features pagination.

Fields§

§subject: String

Full Subject URL of the resource, including query parameters

§property: Option<String>

The property which the results are to be filtered by

§value: Option<String>

The value which the results are to be filtered by

§members: Vec<String>

The actual items that you’re interested in. List the member subjects of the current page.

§members_nested: Option<Vec<Resource>>

The members as full resources, instead of a list of subjects. Is only populated if nested is true.

§sort_by: Option<String>

URL of the value to sort by

§sort_desc: bool§page_size: usize

How many items per page

§current_page: usize

Current page number, defaults to 0 (first page)

§total_items: usize

Total number of items

§total_pages: usize

Total number of pages

§name: Option<String>

Human readable name of a resource

§include_nested: bool

Whether it’s children should be included as nested resources in the response

§include_external: bool

Include resources from other servers

Implementations§

Source§

impl Collection

Source

pub fn collect_members( store: &impl Storelike, collection_builder: CollectionBuilder, for_agent: &ForAgent, ) -> AtomicResult<Collection>

Constructs a Collection, which is a paginated list of items with some sorting applied. Gets the required data from the store. Applies sorting settings.

Source

pub fn to_resource(&self, store: &impl Storelike) -> AtomicResult<Resource>

Source

pub fn add_to_resource( &self, resource: &mut Resource, store: &impl Storelike, ) -> AtomicResult<Resource>

Adds the Collection props to an existing Resource.

Trait Implementations§

Source§

impl Debug for Collection

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more