pub struct NoteBuilder { /* private fields */ }Expand description
Builder for Note.
Implementations§
Source§impl NoteBuilder
impl NoteBuilder
pub fn deck_name(&mut self, value: String) -> &mut Self
pub fn model_name(&mut self, value: String) -> &mut Self
pub fn options(&mut self, value: NoteOptions) -> &mut Self
pub fn audios(&mut self, value: Vec<Media>) -> &mut Self
pub fn videos(&mut self, value: Vec<Media>) -> &mut Self
pub fn pictures(&mut self, value: Vec<Media>) -> &mut Self
Source§impl NoteBuilder
impl NoteBuilder
pub fn field(&mut self, field_name: &str, value: &str) -> &mut Self
Sourcepub fn extend_fields(
&mut self,
append: impl IntoIterator<Item = (String, String)>,
) -> &mut Self
pub fn extend_fields( &mut self, append: impl IntoIterator<Item = (String, String)>, ) -> &mut Self
Appends current fields with an Iterator<(field_name, content)>;
Sourcepub async fn build(&mut self, client: Option<&Client>) -> AnkiResult<Note>
pub async fn build(&mut self, client: Option<&Client>) -> AnkiResult<Note>
Builds a new note with its media as bytes.
§Information
MediaSource::Url => Downloads verified url::Url data & converts to base64. MediaSource::Path => Calls tokio::fs::read on the PathBuf. MediaSource::Data => Returns the data directly. Expected that the bytes are base64 encoded. Should return an error later by checking encoding.
If you created all media using builder using only data field directly,
it will not make any internal requests.
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 moreAuto 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