pub struct TDesktop { /* private fields */ }Expand description
Telegram Desktop client representation
Represents a parsed tdata folder with all its accounts.
Implementations§
Source§impl TDesktop
impl TDesktop
Sourcepub fn from_default() -> Result<Self>
pub fn from_default() -> Result<Self>
Load TDesktop from the default tdata location
§Returns
Ok(TDesktop)if loading succeededErr(Error::FolderNotFound)if the default location doesn’t exist
Sourcepub fn from_path_with_passcode<P: AsRef<Path>>(
path: P,
passcode: &str,
) -> Result<Self>
pub fn from_path_with_passcode<P: AsRef<Path>>( path: P, passcode: &str, ) -> Result<Self>
Load TDesktop with a passcode
Use this when the tdata is protected with a Local Passcode.
§Arguments
path: Path to the tdata folderpasscode: The Local Passcode
Sourcepub fn with_options<P: AsRef<Path>>(
path: P,
passcode: Option<&str>,
key_file: Option<&str>,
) -> Result<Self>
pub fn with_options<P: AsRef<Path>>( path: P, passcode: Option<&str>, key_file: Option<&str>, ) -> Result<Self>
Load TDesktop with all options
§Arguments
path: Path to the tdata folderpasscode: Optional Local Passcodekey_file: Optional key file name (default: “data”)
Sourcepub const fn accounts_count(&self) -> usize
pub const fn accounts_count(&self) -> usize
Get the number of accounts
Sourcepub fn main_account(&self) -> Option<&Account>
pub fn main_account(&self) -> Option<&Account>
Get the main (first) account
Sourcepub const fn app_version(&self) -> u32
pub const fn app_version(&self) -> u32
Get the app version
Sourcepub const fn has_passcode(&self) -> bool
pub const fn has_passcode(&self) -> bool
Check if the tdata has a passcode
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TDesktop
impl RefUnwindSafe for TDesktop
impl Send for TDesktop
impl Sync for TDesktop
impl Unpin for TDesktop
impl UnsafeUnpin for TDesktop
impl UnwindSafe for TDesktop
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