Skip to main content

ManagedSnapshot

Struct ManagedSnapshot 

Source
pub struct ManagedSnapshot {
    pub handle: SnapshotHandle,
    pub projects: Vec<ProjectResponse>,
    pub changes: Option<SnapshotChanges>,
    /* private fields */
}
Expand description

Live snapshot handle with automatic release-on-drop semantics.

A managed snapshot bundles the opaque remote handle together with the project list and optional change summary returned by updateSnapshot. When the wrapper is dropped, it schedules a best-effort handle release so callers do not leak server-side snapshot state accidentally.

Fields§

§handle: SnapshotHandle

Opaque snapshot handle used by follow-up API requests.

§projects: Vec<ProjectResponse>

Projects visible inside the snapshot at creation time.

§changes: Option<SnapshotChanges>

Optional project-level delta information returned by tsgo.

Implementations§

Source§

impl ManagedSnapshot

Source

pub fn project(&self, config_file_name: &str) -> Option<&ProjectResponse>

Looks up a project by its tsconfig path.

This is a convenience helper for the common “find the project that owns this config file” flow after snapshot creation.

Source

pub async fn get_default_project_for_file( &self, file: impl Into<DocumentIdentifier>, ) -> Result<Option<ProjectResponse>, TsgoError>

Delegates to ApiClient::get_default_project_for_file using this snapshot.

Source

pub async fn release(&self) -> Result<(), TsgoError>

Releases the snapshot handle if it has not already been released.

Calling this eagerly can reduce remote memory usage in long-lived processes when the snapshot is known to be dead before Rust drop runs.

Trait Implementations§

Source§

impl Drop for ManagedSnapshot

Source§

fn drop(&mut self)

Executes the destructor for this type. 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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.