Struct Page

Source
pub struct Page<V: FhirVersion, R> { /* private fields */ }
Expand description

Wrapper around Bundles that have multiple pages of results, e.g. search results, resource history, etc.

Implementations§

Source§

impl<V: FhirVersion, R> Page<V, R>
where (StatusCode, V::OperationOutcome): Into<Error>, R: TryFrom<V::Resource> + Send + Sync + 'static, for<'a> &'a R: TryFrom<&'a V::Resource>,

Source

pub fn next_page_url(&self) -> Option<&String>

Get the next page URL, if there is one.

Source

pub async fn next_page(&self) -> Option<Result<Self, Error>>

Fetch the next page and return it.

Source

pub fn total(&self) -> Option<u32>

Get the total field, indicating the total number of results.

Source

pub const fn bundle(&self) -> &V::Bundle

Get access to the inner Bundle.

Source

pub fn into_inner(self) -> V::Bundle

Consume the Page and return the inner Bundle.

Source

pub fn take_entries( &mut self, ) -> Vec<Option<<<V as FhirVersion>::Bundle as BundleExt>::Entry>>

Consumes the raw inner entries, leaving the page empty. Returns the entries.

Source

pub fn entries(&self) -> impl Iterator<Item = &V::Resource> + Send

Get the entries of this page, ignoring entries whenever there is no resource in the entry.

Source

pub fn matches(&self) -> impl Iterator<Item = &R> + Send

Get the matches of this page, ignoring entries whenever there is no resource in the entry or resources of the wrong type.

Source

pub fn entries_owned( &mut self, ) -> impl Stream<Item = Result<V::Resource, Error>> + Send + 'static

Get the entries of this page, where the fullUrl is automatically resolved whenever there is no resource in the entry. Delete entries are ignored as well (e.g. in history requests), you can access the raw entries with Self::bundle or Self::take_entries if you need these. Consumes the entries, leaving the page empty.

Source

pub fn matches_owned( &mut self, ) -> impl Stream<Item = Result<R, Error>> + Send + 'static

Get the matches of this page, where the fullUrl is automatically resolved whenever there is no resource in the entry. Delete entries are ignored as well (e.g. in history requests), you can access the raw entries with Self::bundle or Self::take_entries if you need these. Ignores entries of the wrong resource type and entries without resource or full URL. Consumes the entries, leaving the page empty.

Source

pub fn all_entries( self, ) -> impl Stream<Item = Result<V::Resource, Error>> + Send + 'static

Start automatic paging through all entries across pages.

Hint: you can activate pre-fetching by StreamExt::buffered.

Source

pub fn all_matches( self, ) -> impl Stream<Item = Result<R, Error>> + Send + 'static

Start automatic paging through all matches across pages.

Hint: you can activate pre-fetching by StreamExt::buffered.

Trait Implementations§

Source§

impl<V: FhirVersion, R> Clone for Page<V, R>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<V: FhirVersion, R> Debug for Page<V, R>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<V, R> !Freeze for Page<V, R>

§

impl<V, R> !RefUnwindSafe for Page<V, R>

§

impl<V, R> Send for Page<V, R>
where R: Send,

§

impl<V, R> Sync for Page<V, R>
where R: Sync,

§

impl<V, R> Unpin for Page<V, R>
where R: Unpin,

§

impl<V, R> !UnwindSafe for Page<V, R>

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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
Source§

impl<T> ErasedDestructor for T
where T: 'static,