pub struct MutableSnapshot<T: Debug>(pub MutableOnDemand<Option<SharedSnapshot<T>>>);
Expand description

Use this type for fields in structs that are to store the Snapshot, typically behind an OwnShared.

Note that the resource itself is behind another OwnShared to allow it to be used without holding any kind of lock, hence without blocking updates while it is used.

Tuple Fields§

§0: MutableOnDemand<Option<SharedSnapshot<T>>>

Implementations§

Create a new instance of this type.

Useful in case Default::default() isn’t working for some reason.

Refresh state forcefully by re-opening the resource. Note that open() returns None if the resource isn’t present on disk, and that it’s critical that the modified time is obtained before opening the resource.

Assure that the resource in state is up-to-date by comparing the current_modification_time with the one we know in state and by acting accordingly. Returns the potentially updated/reloaded resource if it is still present on disk, which then represents a snapshot that is up-to-date in that very moment, or None if the underlying file doesn’t exist.

Note that even though this is racy, each time a request is made there is a chance to see the actual state.

Trait Implementations§

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
The resulting type after dereferencing.
Dereferences the value.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.