pub struct NoteBuilder { /* private fields */ }Expand description
Builder for creating notes with a fluent API.
§Example
use ankit::NoteBuilder;
let note = NoteBuilder::new("My Deck", "Basic")
.field("Front", "What is the capital of France?")
.field("Back", "Paris")
.tag("geography")
.tag("europe")
.build();Implementations§
Source§impl NoteBuilder
impl NoteBuilder
Sourcepub fn new(deck: impl Into<String>, model: impl Into<String>) -> NoteBuilder
pub fn new(deck: impl Into<String>, model: impl Into<String>) -> NoteBuilder
Create a new note builder.
§Arguments
deck- The deck name to add the note tomodel- The note type (model) name
Sourcepub fn field(
self,
name: impl Into<String>,
value: impl Into<String>,
) -> NoteBuilder
pub fn field( self, name: impl Into<String>, value: impl Into<String>, ) -> NoteBuilder
Set a field value.
Field names are case-sensitive and must match the model exactly.
Values are HTML - use < for literal <.
Sourcepub fn tag(self, tag: impl Into<String>) -> NoteBuilder
pub fn tag(self, tag: impl Into<String>) -> NoteBuilder
Add a tag to the note.
Add multiple tags to the note.
Sourcepub fn audio(self, attachment: MediaAttachment) -> NoteBuilder
pub fn audio(self, attachment: MediaAttachment) -> NoteBuilder
Add an audio attachment.
Sourcepub fn video(self, attachment: MediaAttachment) -> NoteBuilder
pub fn video(self, attachment: MediaAttachment) -> NoteBuilder
Add a video attachment.
Sourcepub fn picture(self, attachment: MediaAttachment) -> NoteBuilder
pub fn picture(self, attachment: MediaAttachment) -> NoteBuilder
Add a picture attachment.
Sourcepub fn allow_duplicate(self, allow: bool) -> NoteBuilder
pub fn allow_duplicate(self, allow: bool) -> NoteBuilder
Allow duplicate notes.
Sourcepub fn duplicate_scope(self, scope: DuplicateScope) -> NoteBuilder
pub fn duplicate_scope(self, scope: DuplicateScope) -> NoteBuilder
Set the duplicate checking scope.
Sourcepub fn duplicate_scope_deck(self, deck: impl Into<String>) -> NoteBuilder
pub fn duplicate_scope_deck(self, deck: impl Into<String>) -> NoteBuilder
Set the deck to check for duplicates in.
Trait Implementations§
Source§impl Clone for NoteBuilder
impl Clone for NoteBuilder
Source§fn clone(&self) -> NoteBuilder
fn clone(&self) -> NoteBuilder
Returns a duplicate of the value. Read more
1.0.0 · 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 NoteBuilder
impl Debug for NoteBuilder
Source§impl Default for NoteBuilder
impl Default for NoteBuilder
Source§fn default() -> NoteBuilder
fn default() -> NoteBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for NoteBuilder
impl RefUnwindSafe for NoteBuilder
impl Send for NoteBuilder
impl Sync for NoteBuilder
impl Unpin for NoteBuilder
impl UnwindSafe for NoteBuilder
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