pub struct Chat {
    pub rowid: i32,
    pub chat_identifier: String,
    pub service_name: Option<String>,
    pub display_name: Option<String>,
}
Expand description

Represents a single row in the chat table.

Fields§

§rowid: i32§chat_identifier: String§service_name: Option<String>§display_name: Option<String>

Implementations§

source§

impl Chat

source

pub fn name(&self) -> &str

source

pub fn display_name(&self) -> Option<&str>

Trait Implementations§

source§

impl Cacheable for Chat

source§

fn cache(db: &Connection) -> Result<HashMap<Self::K, Self::V>, TableError>

Generate a hashmap containing each chatroom’s ID pointing to the chatroom’s metadata.

These chatroom ID’s contain duplicates and must be deduped later once we have all of the participants parsed out. On its own this data is not useful.

Example:
use imessage_database::util::dirs::default_db_path;
use imessage_database::tables::table::{Cacheable, get_connection};
use imessage_database::tables::chat::Chat;

let db_path = default_db_path();
let conn = get_connection(&db_path).unwrap();
let chatrooms = Chat::cache(&conn);
§

type K = i32

§

type V = Chat

source§

impl Debug for Chat

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Table for Chat

source§

fn from_row(row: &Row<'_>) -> Result<Chat>

Serializes a single row of data to an instance of the struct that implements this Trait
source§

fn get(db: &Connection) -> Result<Statement<'_>, TableError>

Gets a statement we can execute to iterate over the data in the table
source§

fn extract(chat: Result<Result<Self, Error>, Error>) -> Result<Self, TableError>

Extract valid row data while handling both types of query errors

Auto Trait Implementations§

§

impl RefUnwindSafe for Chat

§

impl Send for Chat

§

impl Sync for Chat

§

impl Unpin for Chat

§

impl UnwindSafe for Chat

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> Same for T

§

type Output = T

Should always be Self
source§

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

§

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>,

§

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.