# SessionService

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-protranslate-studio/struct-sessionservice/

**struct** · [`ferroui-protranslate-studio`](/docs/0.5.0/api/ferroui-protranslate-studio/) · v0.5.0

```rust
struct SessionService
```

Session, recovery and backup storage share the same explicit host boundary.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/persistence.rs#L312)

## Members

- [`new`](#function-new)
- [`storage`](#function-storage)
- [`paths`](#function-paths)
- [`default_session_path`](#function-default_session_path)
- [`save_snapshot`](#function-save_snapshot)
- [`save_session`](#function-save_session)
- [`load_session`](#function-load_session)
- [`save_recovery`](#function-save_recovery)
- [`recovery_session`](#function-recovery_session)
- [`clear_recovery`](#function-clear_recovery)
- [`restore_recovery`](#function-restore_recovery)
- [`create_backup`](#function-create_backup)
- [`list_backups`](#function-list_backups)
- [`restore_backup`](#function-restore_backup)
- [`delete_backup`](#function-delete_backup)
- [`rotate_backups`](#function-rotate_backups)
- [`backup_and_rotate`](#function-backup_and_rotate)

<a id="function-new"></a>

### new

```rust
fn new(storage: Rc<dyn StudioStorage>, paths: StudioPaths) -> Self
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/persistence.rs#L318)

<a id="function-storage"></a>

### storage

```rust
fn storage(self: &Self) -> &Rc<dyn StudioStorage>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/persistence.rs#L325)

<a id="function-paths"></a>

### paths

```rust
fn paths(self: &Self) -> &StudioPaths
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/persistence.rs#L328)

<a id="function-default_session_path"></a>

### default_session_path

```rust
fn default_session_path(self: &Self, session: &TranslationSession) -> Result<String, StudioError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/persistence.rs#L331)

<a id="function-save_snapshot"></a>

### save_snapshot

```rust
fn save_snapshot(self: &Self, session: &TranslationSession, path: Option<&str>) -> Result<String, StudioError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/persistence.rs#L341)

<a id="function-save_session"></a>

### save_session

```rust
fn save_session(self: &Self, document: &mut StudioDocument, path: Option<&str>, now_millis: i64) -> Result<SaveOutcome, StudioError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/persistence.rs#L353)

<a id="function-load_session"></a>

### load_session

```rust
fn load_session(self: &Self, path: &str) -> Result<Option<TranslationSession>, StudioError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/persistence.rs#L368)

<a id="function-save_recovery"></a>

### save_recovery

```rust
fn save_recovery(self: &Self, document: &StudioDocument, now_millis: i64) -> Result<(), StudioError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/persistence.rs#L374)

<a id="function-recovery_session"></a>

### recovery_session

```rust
fn recovery_session(self: &Self) -> Result<Option<TranslationSession>, StudioError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/persistence.rs#L384)

<a id="function-clear_recovery"></a>

### clear_recovery

```rust
fn clear_recovery(self: &Self) -> Result<(), StudioError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/persistence.rs#L387)

<a id="function-restore_recovery"></a>

### restore_recovery

```rust
fn restore_recovery(self: &Self, document: &mut StudioDocument) -> Result<bool, StudioError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/persistence.rs#L390)

<a id="function-create_backup"></a>

### create_backup

```rust
fn create_backup(self: &Self, session: &TranslationSession, now_millis: i64) -> Result<BackupMetadata, StudioError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/persistence.rs#L397)

<a id="function-list_backups"></a>

### list_backups

```rust
fn list_backups(self: &Self) -> Result<Vec<BackupMetadata>, StudioError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/persistence.rs#L441)

<a id="function-restore_backup"></a>

### restore_backup

```rust
fn restore_backup(self: &Self, path: &str) -> Result<Option<TranslationSession>, StudioError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/persistence.rs#L478)

<a id="function-delete_backup"></a>

### delete_backup

```rust
fn delete_backup(self: &Self, path: &str) -> Result<(), StudioError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/persistence.rs#L485)

<a id="function-rotate_backups"></a>

### rotate_backups

```rust
fn rotate_backups(self: &Self, max_count: usize) -> Result<usize, StudioError>
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/persistence.rs#L489)

<a id="function-backup_and_rotate"></a>

### backup_and_rotate

```rust
fn backup_and_rotate(self: &Self, session: &TranslationSession, now_millis: i64, max_count: usize) -> Result<BackupMetadata, StudioError>
```

Rotation runs only once a complete replacement backup is safely stored.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/ProTranslate/FerroUI.ProTranslate.Studio/persistence.rs#L499)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ErasedDestructor`
- `IntoEither`

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
