pub struct ResourceOptions {
pub id_param: String,
pub id_field: Option<String>,
pub name: Option<String>,
pub operations: Vec<String>,
pub require_precondition: bool,
pub upsert: bool,
}Expand description
How a resource is registered.
Fields§
§id_param: StringPath parameter holding the identifier.
id_field: Option<String>Field of an item holding the identifier; None asks the store.
name: Option<String>Human readable name used in problem details.
operations: Vec<String>Subset of RESOURCE_OPERATIONS to expose.
require_precondition: boolDemand If-Match on PUT, PATCH and DELETE.
upsert: boolLet PUT create a missing item.
Implementations§
Source§impl ResourceOptions
impl ResourceOptions
Sourcepub fn with_name<S: Into<String>>(self, name: S) -> Self
pub fn with_name<S: Into<String>>(self, name: S) -> Self
The same options with a human readable resource name.
Sourcepub fn with_id_param<S: Into<String>>(self, id_param: S) -> Self
pub fn with_id_param<S: Into<String>>(self, id_param: S) -> Self
The same options with another path parameter for the identifier.
Sourcepub fn with_id_field<S: Into<String>>(self, id_field: S) -> Self
pub fn with_id_field<S: Into<String>>(self, id_field: S) -> Self
The same options with another identifier field.
Sourcepub fn with_operations<I, S>(self, operations: I) -> Self
pub fn with_operations<I, S>(self, operations: I) -> Self
The same options exposing only these operations.
Sourcepub fn requiring_precondition(self, require: bool) -> Self
pub fn requiring_precondition(self, require: bool) -> Self
The same options demanding If-Match on every unsafe method.
Sourcepub fn with_upsert(self, upsert: bool) -> Self
pub fn with_upsert(self, upsert: bool) -> Self
The same options letting PUT create a missing item.
Trait Implementations§
Source§impl Clone for ResourceOptions
impl Clone for ResourceOptions
Source§fn clone(&self) -> ResourceOptions
fn clone(&self) -> ResourceOptions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ResourceOptions
impl Debug for ResourceOptions
Source§impl Default for ResourceOptions
impl Default for ResourceOptions
impl Eq for ResourceOptions
Source§impl PartialEq for ResourceOptions
impl PartialEq for ResourceOptions
impl StructuralPartialEq for ResourceOptions
Auto Trait Implementations§
impl Freeze for ResourceOptions
impl RefUnwindSafe for ResourceOptions
impl Send for ResourceOptions
impl Sync for ResourceOptions
impl Unpin for ResourceOptions
impl UnsafeUnpin for ResourceOptions
impl UnwindSafe for ResourceOptions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.