Skip to main content

Handle

Struct Handle 

Source
pub struct Handle {
    pub rowid: i32,
    pub id: String,
    pub person_centric_id: Option<String>,
}
Expand description

Row from the handle table.

Fields§

§rowid: i32

Handle row ID.

§id: String

Phone number, email address, or service identifier.

§person_centric_id: Option<String>

Legacy merge ID that the iMessage server used to identify handles for one sender account.

Implementations§

Source§

impl Handle

Source

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

Prepare the SELECT * statement for the handle table.

Source

pub fn load(db: &Connection) -> Result<Vec<Handle>, TableError>

Load every row of the handle table in query order.

Load once and share the rows: borrow them with HandleGroups::from_rows before consuming them with Handle::ids_by_rowid.

§Example:
use imessage_database::util::dirs::default_db_path;
use imessage_database::tables::table::get_connection;
use imessage_database::tables::handle::{Handle, HandleGroups};

let db_path = default_db_path().unwrap();
let conn = get_connection(&db_path).unwrap();
let handles = Handle::load(&conn).unwrap();
let groups = HandleGroups::from_rows(&handles);
let ids = Handle::ids_by_rowid(handles);
Source

pub fn ids_by_rowid(handles: Vec<Handle>) -> HashMap<i32, String>

Map handle identifiers by row ID.

In group chats, treat row ID 0 as the local user and map it to ME. Use HandleGroups to group rows that belong to one person.

§Example:
use imessage_database::util::dirs::default_db_path;
use imessage_database::tables::table::get_connection;
use imessage_database::tables::handle::Handle;

let db_path = default_db_path().unwrap();
let conn = get_connection(&db_path).unwrap();
let handles = Handle::ids_by_rowid(Handle::load(&conn).unwrap());
Source§

impl Handle

Source

pub fn run_diagnostic(db: &Connection) -> Result<HandleDiagnostic, TableError>

Compute diagnostic data for the handle table.

Group rows with HandleGroups, then report the extra rows absorbed into groups and the number of groups with multiple rows. Count person_centric_id values separately when the column exists.

§Example:
use imessage_database::util::dirs::default_db_path;
use imessage_database::tables::table::get_connection;
use imessage_database::tables::handle::Handle;

let db_path = default_db_path().unwrap();
let conn = get_connection(&db_path).unwrap();
Handle::run_diagnostic(&conn);

Trait Implementations§

Source§

impl Debug for Handle

Source§

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

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

impl Table for Handle

Source§

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

Deserialize a single row into Self. Returns rusqlite::Result for direct use inside rusqlite::query_map / query_row callbacks. For high-level iteration, prefer Table::rows or Table::row.
Source§

fn rows<'stmt, P: Params>( stmt: &'stmt mut Statement<'_>, params: P, ) -> Result<impl Iterator<Item = Result<Self, TableError>> + 'stmt, TableError>
where Self: 'stmt,

Iterate over the results of stmt, deserializing each row through from_row. Return TableError for both fetch and deserialization failures. Pass either a rusqlite::Statement or a rusqlite::CachedStatement (via deref coercion).
Source§

fn row<P: Params>( stmt: &mut Statement<'_>, params: P, ) -> Result<Self, TableError>

Fetch exactly one row from stmt. Returns TableError::QueryError if the row is missing or fails to deserialize. Accepts both rusqlite::Statement and rusqlite::CachedStatement (the latter via deref coercion).

Auto Trait Implementations§

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

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.