Note

Struct Note 

Source
pub struct Note<'a, IOM: Write<SevenBitAddress> + Read<SevenBitAddress>, const BS: usize> { /* private fields */ }

Implementations§

Source§

impl<'a, IOM: Write<SevenBitAddress> + Read<SevenBitAddress>, const BS: usize> Note<'a, IOM, BS>

Source

pub fn from(note: &mut Notecard<IOM, BS>) -> Note<'_, IOM, BS>

Source

pub fn add<T: Serialize + Default>( self, delay: &mut impl DelayMs<u16>, file: Option<&str>, note: Option<&str>, body: Option<T>, payload: Option<&str>, sync: bool, ) -> Result<FutureResponse<'a, Add, IOM, BS>, NoteError>

Adds a note to a notefile, creating the Notefile if it doesn’t yet exist. When sending this request to the Notecard, if a Notefile name is specified, the file must either be a DB Notefile or outbound queue file (.qo/.qos). When sending this request to Notehub, the file must either be a DB Notefile or an inbound queue file (.qi/.qis).

If you don’t use a template the size of the payload is maximum 250 bytes, with a template 8KB seems to work.

Source

pub fn update<T: Serialize + Default>( self, delay: &mut impl DelayMs<u16>, file: &str, note: &str, body: Option<T>, payload: Option<&str>, verify: bool, ) -> Result<FutureResponse<'a, Empty, IOM, BS>, NoteError>

Updates a Note in a DB Notefile by its ID, replacing the existing body and/or payload.

Source

pub fn get<T: DeserializeOwned + Serialize>( self, delay: &mut impl DelayMs<u16>, file: &str, note: &str, delete: bool, deleted: bool, ) -> Result<FutureResponse<'a, Get<T>, IOM, BS>, NoteError>

Retrieves a Note from a Notefile.

  • When sending this request to the Notecard, the file must either be a DB Notefile (.db or .dbx) or inbound queue file (.qi/.qis).
  • When sending this request to Notehub, the file must be a DB Notefile (.db).

.qo/.qos Notes must be read from the Notehub event table using the Notehub Event API.

Source

pub fn delete( self, delay: &mut impl DelayMs<u16>, file: &str, note: &str, ) -> Result<FutureResponse<'a, Empty, IOM, BS>, NoteError>

Deletes Notefiles from a DB Notefile by its Note ID. To delete Notes from a .qi Notefile, use note.get or note.changes with delete:true.

Source

pub fn template<T: Serialize + Default>( self, delay: &mut impl DelayMs<u16>, file: Option<&str>, body: Option<T>, length: Option<u32>, format: TemplateFormat, port: Option<u32>, delete: Option<bool>, ) -> Result<FutureResponse<'a, Template, IOM, BS>, NoteError>

Using the note.template request command with any .qo/.qos Notefile, developers can provide the Notecard with a schema of sorts to apply to future Notes added to the Notefile. This template acts as a hint to the Notecard that allows it to internally store data as fixed-length binary records rather than as flexible JSON objects which require much more memory. Using templated Notes in place of regular Notes increases the storage and sync capability of the Notecard by an order of magnitude.

See https://dev.blues.io/notecard/notecard-walkthrough/low-bandwidth-design/#understanding-template-data-types for the format and values of the template.

Auto Trait Implementations§

§

impl<'a, IOM, const BS: usize> Freeze for Note<'a, IOM, BS>

§

impl<'a, IOM, const BS: usize> RefUnwindSafe for Note<'a, IOM, BS>
where IOM: RefUnwindSafe,

§

impl<'a, IOM, const BS: usize> Send for Note<'a, IOM, BS>
where IOM: Send,

§

impl<'a, IOM, const BS: usize> Sync for Note<'a, IOM, BS>
where IOM: Sync,

§

impl<'a, IOM, const BS: usize> Unpin for Note<'a, IOM, BS>

§

impl<'a, IOM, const BS: usize> !UnwindSafe for Note<'a, IOM, BS>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.