# StudioDocument

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

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

```rust
struct StudioDocument
```

An owned document; hosts decide how to expose notifications and selection.

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

## Members

- [`new`](#function-new)
- [`from_session`](#function-from_session)
- [`restore`](#function-restore)
- [`session`](#function-session)
- [`snapshot`](#function-snapshot)
- [`catalog`](#function-catalog)
- [`is_dirty`](#function-is_dirty)
- [`mark_saved`](#function-mark_saved)
- [`generation`](#function-generation)
- [`undo_count`](#function-undo_count)
- [`redo_count`](#function-redo_count)
- [`set_history_limit`](#function-set_history_limit)
- [`entry`](#function-entry)
- [`filtered_ids`](#function-filtered_ids)
- [`metrics`](#function-metrics)
- [`coverage`](#function-coverage)
- [`set_target`](#function-set_target)
- [`set_notes`](#function-set_notes)
- [`set_review`](#function-set_review)
- [`replace_entry`](#function-replace_entry)
- [`add_entry`](#function-add_entry)
- [`delete_entry`](#function-delete_entry)
- [`add_target_culture`](#function-add_target_culture)
- [`set_target_culture`](#function-set_target_culture)
- [`export`](#function-export)
- [`materialize_target_culture`](#function-materialize_target_culture)
- [`catalog_with_review_states`](#function-catalog_with_review_states)
- [`entry_diagnostics`](#function-entry_diagnostics)
- [`transaction`](#function-transaction)
- [`undo`](#function-undo)
- [`redo`](#function-redo)
- [`prepare_translation`](#function-prepare_translation)
- [`prepare_missing_translations`](#function-prepare_missing_translations)
- [`accept_suggestion`](#function-accept_suggestion)
- [`accept_suggestions`](#function-accept_suggestions)

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

### new

```rust
fn new(session_id: impl Into<String>, imported: ImportedCatalog, now_millis: i64) -> Result<Self, StudioError>
```



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

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

### from_session

```rust
fn from_session(session: TranslationSession) -> Result<Self, StudioError>
```



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

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

### restore

```rust
fn restore(self: &mut Self, session: TranslationSession, recovered: bool) -> Result<(), StudioError>
```



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

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

### session

```rust
fn session(self: &Self) -> &TranslationSession
```



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

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

### snapshot

```rust
fn snapshot(self: &Self, now_millis: i64) -> TranslationSession
```



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

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

### catalog

```rust
fn catalog(self: &Self) -> &TranslationCatalog
```



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

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

### is_dirty

```rust
fn is_dirty(self: &Self) -> bool
```



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

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

### mark_saved

```rust
fn mark_saved(self: &mut Self, snapshot: &TranslationSession) -> bool
```

Call only after the host successfully persisted this exact snapshot.

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

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

### generation

```rust
fn generation(self: &Self) -> u64
```



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

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

### undo_count

```rust
fn undo_count(self: &Self) -> usize
```



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

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

### redo_count

```rust
fn redo_count(self: &Self) -> usize
```



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

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

### set_history_limit

```rust
fn set_history_limit(self: &mut Self, limit: usize)
```



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

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

### entry

```rust
fn entry(self: &Self, id: EntryId) -> Option<(&TranslationCatalogEntry, &EntryStatus)>
```



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

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

### filtered_ids

```rust
fn filtered_ids(self: &Self, filter: &EntryFilter) -> Vec<EntryId>
```



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

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

### metrics

```rust
fn metrics(self: &Self, culture: Option<&str>) -> ReviewMetrics
```



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

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

### coverage

```rust
fn coverage(self: &Self) -> Vec<TranslationCoverage>
```

Distinct keys use the converter's last-entry-wins rule. Missing keys count.

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

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

### set_target

```rust
fn set_target(self: &mut Self, id: EntryId, value: impl Into<String>) -> Result<bool, StudioError>
```



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

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

### set_notes

```rust
fn set_notes(self: &mut Self, id: EntryId, notes: Option<String>) -> Result<bool, StudioError>
```



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

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

### set_review

```rust
fn set_review(self: &mut Self, id: EntryId, review: TranslationReviewState) -> Result<bool, StudioError>
```



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

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

### replace_entry

```rust
fn replace_entry(self: &mut Self, id: EntryId, value: TranslationCatalogEntry, review: TranslationReviewState) -> Result<bool, StudioError>
```



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

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

### add_entry

```rust
fn add_entry(self: &mut Self, entry: TranslationCatalogEntry) -> Result<EntryId, StudioError>
```



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

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

### delete_entry

```rust
fn delete_entry(self: &mut Self, id: EntryId) -> Result<(), StudioError>
```



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

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

### add_target_culture

```rust
fn add_target_culture(self: &mut Self, culture_name: &str, display_name: impl Into<String>) -> Result<bool, StudioError>
```



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

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

### set_target_culture

```rust
fn set_target_culture(self: &mut Self, culture: &str) -> Result<bool, StudioError>
```



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

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

### export

```rust
fn export(self: &Self, format: TranslationFileFormat, options: &TranslationFormatOptions) -> Result<TranslationExportResult, StudioError>
```

Export the normalized catalog with its original native format states.
For Studio review states, explicitly export `catalog_with_review_states()`
through `CatalogGateway`; its generic states may incur format-loss warnings.

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

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

### materialize_target_culture

```rust
fn materialize_target_culture(self: &mut Self, culture: &str) -> Result<Vec<EntryId>, StudioError>
```

Add missing rows for a target culture without replacing existing work.
Source/context/plural metadata is copied from the last normalized key;
new values and original file review states are cleared.

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

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

### catalog_with_review_states

```rust
fn catalog_with_review_states(self: &Self) -> TranslationCatalog
```

Explicit review-state projection for workflows that want Studio approvals
in the exchange file. The preserved source catalog remains unchanged.

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

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

### entry_diagnostics

```rust
fn entry_diagnostics(self: &Self, id: EntryId) -> Result<Vec<String>, StudioError>
```



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

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

### transaction

```rust
fn transaction<R>(self: &mut Self, action: impl FnOnce(&mut Self) -> Result<R, StudioError>) -> Result<R, StudioError>
```

One history record for a set of edits. Failed edits leave the document intact.

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

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

### undo

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



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

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

### redo

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



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

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

### prepare_translation

```rust
fn prepare_translation(self: &Self, ids: &[EntryId], context: impl Into<String>) -> Result<TranslationPlan, StudioError>
```



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

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

### prepare_missing_translations

```rust
fn prepare_missing_translations(self: &Self, context: impl Into<String>) -> Result<TranslationPlan, StudioError>
```



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

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

### accept_suggestion

```rust
fn accept_suggestion(self: &mut Self, suggestion: &TranslationSuggestion) -> Result<bool, StudioError>
```



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

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

### accept_suggestions

```rust
fn accept_suggestions(self: &mut Self, suggestions: &[TranslationSuggestion]) -> Result<usize, StudioError>
```

The whole accepted batch is one undo operation. Any stale suggestion
rejects the batch before writing, so a later edit can never be lost.

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

## 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/).
