Expand description
AnkiBridge is a Rust library that serves as a bridge between your Rust code and the Anki application, leveraging the AnkiConnect add-on to establish an HTTP connection. This library enables seamless transmission of data and facilitates interaction with Anki through Rust.
§Installation
To use AnkiBridge in your Rust project, add the following line to your Cargo.toml
file:
[dependencies]
anki_bridge = { version = "0.9", features = ["ureq_blocking"] }
Additionally, ensure that you have the Anki application installed on your system and that the AnkiConnect add-on is installed within Anki.
Please note that Anki must be opened and running on your computer for AnkiBridge to establish a connection successfully.
§Usage
To establish a connection and perform actions with Anki, you can use the functions and structs provided by the AnkiBridge library in your Rust code. Here’s a basic example:
use anki_bridge::prelude::*;
// Creates a client to connect to the Anki instance running on the local computer
let anki = AnkiClient::default();
// Fetch the names of all the active decks
let decks = anki.request(DeckNamesRequest {}).unwrap();
dbg!(&decks);
// Fetch statistics about the decks above
let deck_stats = anki.request(GetDeckStatsRequest { decks }).unwrap();
dbg!(&deck_stats);
Modules§
- card_
actions - Module containing card-related actions for
AnkiConnect
. - deck_
actions - Module containing deck-related actions for
AnkiConnect
. - entities
- Module containing entities shared between actions.
- graphical_
actions - Module containing graphical-related actions for
AnkiConnect
. - media_
actions - Module containing media-related actions for
AnkiConnect
. - miscellaneous_
actions - Module containing statistic-related actions for
AnkiConnect
. - mock
- Module containing mockable client which can be used in other projects.
- model_
actions - Module containing model-related actions for
AnkiConnect
. - note_
actions - Module containing notes-related actions for
AnkiConnect
. - prelude
- Prelude module containing commonly used types.
- statistic_
actions - Module containing statistic-related actions for
AnkiConnect
.
Structs§
- Anki
Client - The HTTP client that interacts with the AnkiConnect API.
Enums§
- Error
- Represents the possible errors that can occur during the execution of the
anki_connect_send
function.