Struct meilisearch_sdk::key::KeyBuilder
source · [−]pub struct KeyBuilder {
pub actions: Vec<Action>,
pub description: 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("http://localhost:7700", "masterKey");
let key = KeyBuilder::new("My little lovely test key")
.with_action(Action::DocumentsAdd)
.with_index("*")
.create(&client).await.unwrap();
assert_eq!(key.description, "My little lovely test key");Fields
actions: Vec<Action>description: Stringexpires_at: Option<OffsetDateTime>indexes: Vec<String>Implementations
sourceimpl KeyBuilder
impl KeyBuilder
sourcepub fn new(description: impl AsRef<str>) -> KeyBuilder
pub fn new(description: impl AsRef<str>) -> KeyBuilder
Create a KeyBuilder with only a description.
Example
let builder = KeyBuilder::new("My little lovely test key");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
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 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