Skip to main content

AppServices

Struct AppServices 

Source
pub struct AppServices {
    pub dir: PathBuf,
    pub settings: SettingsStore,
    pub recent_files: RecentFiles,
    pub crashes: CrashDiagnostics,
}
Expand description

应用级服务集合。目录由应用给出;框架只负责 load/save,不自动选择用户目录。

Fields§

§dir: PathBuf§settings: SettingsStore§recent_files: RecentFiles§crashes: CrashDiagnostics

Implementations§

Source§

impl AppServices

Source

pub fn new(dir: impl Into<PathBuf>) -> Self

Source

pub fn settings_path(&self) -> PathBuf

Source

pub fn recent_files_path(&self) -> PathBuf

Source

pub fn crashes_path(&self) -> PathBuf

Source

pub fn load(&mut self) -> Result<()>

保持 0.7 签名的加载入口。

Source

pub fn load_with_report(&mut self) -> Result<LoadReport>

0.8 入口:加载并返回每个文件的确定性结果(含损坏回退标记)。 IO 不可用时该字段记为 IoUnavailable,不误报为损坏。

Source

pub fn save(&mut self) -> Result<()>

保持 0.7 签名的保存入口:写纯文本 + schema sidecar,不强制 owner。 多窗口场景应改用 save_with_owner 以避免并发覆盖。

Source

pub fn save_with_owner(&mut self, owner: &OwnerLease) -> Result<()>

0.8 入口:写入前校验 owner 租约仍有效,防止丢租约后的旧窗口覆盖新数据。

Source

pub fn schema_state(&self) -> SchemaState

Source

pub fn try_acquire_owner(&self) -> Result<OwnerLease, AcquireError>

Source

pub fn heal_after_recovery(&mut self, report: &LoadReport) -> Result<()>

损坏文件恢复后回写主文件,让下一轮读取不再走备份路径。

Trait Implementations§

Source§

impl Clone for AppServices

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AppServices

Source§

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

Formats the value using the given formatter. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.