pub struct DeckExporter<'a> { /* private fields */ }Expand description
Exports decks from Anki to TOML format.
Uses AnkiConnect to fetch deck contents and convert them to a
DeckDefinition that can be serialized to TOML.
Implementations§
Source§impl<'a> DeckExporter<'a>
impl<'a> DeckExporter<'a>
Sourcepub fn new(client: &'a AnkiClient) -> Self
pub fn new(client: &'a AnkiClient) -> Self
Create a new exporter with the given AnkiConnect client.
Sourcepub async fn export_deck(&self, deck_name: &str) -> Result<DeckDefinition>
pub async fn export_deck(&self, deck_name: &str) -> Result<DeckDefinition>
Export a deck to a DeckDefinition.
Fetches all notes in the specified deck, along with the models (note types) they use, and converts them to a TOML-compatible definition.
§Arguments
deck_name- The name of the deck to export (supports hierarchical names like “Parent::Child”)
§Example
use ankit::AnkiClient;
use ankit_builder::DeckExporter;
let client = AnkiClient::new();
let exporter = DeckExporter::new(&client);
let definition = exporter.export_deck("My Deck").await?;
println!("Exported {} notes", definition.notes.len());Sourcepub async fn export_decks(
&self,
deck_names: &[&str],
package_name: &str,
) -> Result<DeckDefinition>
pub async fn export_decks( &self, deck_names: &[&str], package_name: &str, ) -> Result<DeckDefinition>
Export multiple decks to a single DeckDefinition.
Useful for exporting a parent deck and its children, or a set of related decks.
§Arguments
deck_names- The names of the decks to exportpackage_name- The name for the package (used in[package]section)
§Example
use ankit::AnkiClient;
use ankit_builder::DeckExporter;
let client = AnkiClient::new();
let exporter = DeckExporter::new(&client);
let definition = exporter
.export_decks(&["Japanese::N5", "Japanese::N4"], "Japanese JLPT")
.await?;Auto Trait Implementations§
impl<'a> !RefUnwindSafe for DeckExporter<'a>
impl<'a> !UnwindSafe for DeckExporter<'a>
impl<'a> Forget for DeckExporter<'a>
impl<'a> Freeze for DeckExporter<'a>
impl<'a> Send for DeckExporter<'a>
impl<'a> Sync for DeckExporter<'a>
impl<'a> Unpin for DeckExporter<'a>
impl<'a> UnsafeUnpin for DeckExporter<'a>
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