Struct meilisearch_sdk::key::KeyBuilder
source · [−]pub struct KeyBuilder {
pub actions: Vec<Action>,
pub description: Option<String>,
pub name: Option<String>,
pub uid: Option<String>,
pub expires_at: Option<OffsetDateTime>,
pub indexes: Vec<String>,
}Expand description
The KeyBuilder is an analog to the Key type but without all the fields managed by Meilisearch. It’s used to create Key.
Example
let client = Client::new(MEILISEARCH_HOST, MEILISEARCH_API_KEY);
let description = "My little lovely test key".to_string();
let key = KeyBuilder::new()
.with_description(&description)
.execute(&client).await.unwrap();
Fields
actions: Vec<Action>description: Option<String>name: Option<String>uid: Option<String>expires_at: Option<OffsetDateTime>indexes: Vec<String>Implementations
sourceimpl KeyBuilder
impl KeyBuilder
sourcepub fn new() -> KeyBuilder
pub fn new() -> KeyBuilder
sourcepub fn with_actions(
&mut self,
actions: impl IntoIterator<Item = Action>
) -> &mut Self
pub fn with_actions(
&mut self,
actions: impl IntoIterator<Item = Action>
) -> &mut Self
sourcepub fn with_action(&mut self, action: Action) -> &mut Self
pub fn with_action(&mut self, action: Action) -> &mut Self
sourcepub fn with_expires_at(&mut self, expires_at: OffsetDateTime) -> &mut Self
pub fn with_expires_at(&mut self, expires_at: OffsetDateTime) -> &mut Self
sourcepub fn with_indexes(
&mut self,
indexes: impl IntoIterator<Item = impl AsRef<str>>
) -> &mut Self
pub fn with_indexes(
&mut self,
indexes: impl IntoIterator<Item = impl AsRef<str>>
) -> &mut Self
sourcepub fn with_index(&mut self, index: impl AsRef<str>) -> &mut Self
pub fn with_index(&mut self, index: impl AsRef<str>) -> &mut Self
sourcepub fn with_description(&mut self, desc: impl AsRef<str>) -> &mut Self
pub fn with_description(&mut self, desc: impl AsRef<str>) -> &mut Self
Add a description to the key.
Example
let description = "My not so little lovely test key".to_string();
let mut key = KeyBuilder::new()
.with_description(&description)
.execute(&client).await.unwrap();
sourcepub fn with_name(&mut self, desc: impl AsRef<str>) -> &mut Self
pub fn with_name(&mut self, desc: impl AsRef<str>) -> &mut Self
Add a name to the key.
Example
let name = "lovely key".to_string();
let mut key = KeyBuilder::new()
.with_name(&name)
.execute(&client).await.unwrap();
sourcepub fn with_uid(&mut self, desc: impl AsRef<str>) -> &mut Self
pub fn with_uid(&mut self, desc: impl AsRef<str>) -> &mut Self
Add an uid to the key.
Example
let uid = "93bcd7fb-2196-4fd9-acb7-3fca8a96e78f".to_string();
let mut key = KeyBuilder::new()
.with_uid(&uid)
.execute(&client).await.unwrap();
Trait Implementations
sourceimpl AsRef<KeyBuilder> for KeyBuilder
impl AsRef<KeyBuilder> for KeyBuilder
sourcefn as_ref(&self) -> &KeyBuilder
fn as_ref(&self) -> &KeyBuilder
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl Debug for KeyBuilder
impl Debug for KeyBuilder
sourceimpl Default for KeyBuilder
impl Default for KeyBuilder
sourcefn default() -> KeyBuilder
fn default() -> KeyBuilder
Returns the “default value” for a type. Read more
sourceimpl Serialize for KeyBuilder
impl Serialize for KeyBuilder
Auto Trait Implementations
impl RefUnwindSafe for KeyBuilder
impl Send for KeyBuilder
impl Sync for KeyBuilder
impl Unpin for KeyBuilder
impl UnwindSafe for KeyBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more