pub struct LibraryState {Show 13 fields
pub source: LibrarySource,
pub previous_non_search_source: LibrarySource,
pub nav_history: VecDeque<LibrarySource>,
pub sort_mode: LibrarySortMode,
pub load_state: LibraryLoadState,
pub selected_asset_id: Option<String>,
pub albums: Vec<LibraryAlbum>,
pub assets: Vec<LibraryAsset>,
pub next_page: u32,
pub has_more: bool,
pub page_in_flight: bool,
pub generation: u64,
pub status: LibraryStatus,
}Fields§
§source: LibrarySource§previous_non_search_source: LibrarySourceStack of past sources for back-navigation. Pushed by navigate_to,
popped by navigate_back. Searches are not pushed (they are ephemeral).
VecDeque for O(1) front pops when the 50-entry cap is hit.
sort_mode: LibrarySortMode§load_state: LibraryLoadState§selected_asset_id: Option<String>§albums: Vec<LibraryAlbum>§assets: Vec<LibraryAsset>§next_page: u32§has_more: bool§page_in_flight: bool§generation: u64§status: LibraryStatusImplementations§
Source§impl LibraryState
impl LibraryState
pub fn new() -> Self
pub fn load_albums(&mut self, albums: Vec<LibraryAlbum>)
pub fn load_initial_source(&mut self) -> (u64, LibrarySource, u32)
pub fn switch_source( &mut self, source: LibrarySource, ) -> (u64, LibrarySource, u32)
Switch to source, recording the current source in nav_history first
so back-navigation can return to it. Searches are not pushed (they’re
ephemeral). No-ops when navigating to the source we’re already on.
Pop one entry from nav_history and switch to it. Does not push to history. Returns None when there’s nowhere to go back to.
pub fn can_go_back(&self) -> bool
pub fn load_next_page_if_needed(&mut self) -> Option<(u64, LibrarySource, u32)>
pub fn replace_assets( &mut self, generation: u64, items: Vec<LibraryAsset>, ) -> bool
pub fn append_assets( &mut self, generation: u64, items: Vec<LibraryAsset>, ) -> bool
Sourcepub fn replace_assets_with_more(
&mut self,
generation: u64,
items: Vec<LibraryAsset>,
has_more: bool,
) -> bool
pub fn replace_assets_with_more( &mut self, generation: u64, items: Vec<LibraryAsset>, has_more: bool, ) -> bool
replace_assets with an explicit has_more signal — used by search
endpoints that return Immich’s nextPage field, since the page-size
heuristic is wrong when the server returns short pages due to
post-filtering (visibility, archive, etc.).
pub fn append_assets_with_more( &mut self, generation: u64, items: Vec<LibraryAsset>, has_more: bool, ) -> bool
Sourcepub fn apply_sort(&mut self, mode: LibrarySortMode)
pub fn apply_sort(&mut self, mode: LibrarySortMode)
Records the user’s preferred sort mode. LibraryState.assets is always
stored in insertion (server) order so that the sliding-window FIFO
eviction is well-defined; the listmodel layer applies client-side sort
visually for Filename/FileType.
pub fn clear_search_restore_previous_source( &mut self, ) -> Option<(u64, LibrarySource, u32)>
pub fn mark_error(&mut self, generation: u64, message: impl Into<String>)
pub fn set_status( &mut self, stats: Option<ServerStats>, about: Option<ServerAbout>, )
Trait Implementations§
Source§impl Clone for LibraryState
impl Clone for LibraryState
Source§fn clone(&self) -> LibraryState
fn clone(&self) -> LibraryState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LibraryState
impl Debug for LibraryState
Auto Trait Implementations§
impl Freeze for LibraryState
impl RefUnwindSafe for LibraryState
impl Send for LibraryState
impl Sync for LibraryState
impl Unpin for LibraryState
impl UnsafeUnpin for LibraryState
impl UnwindSafe for LibraryState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T, Ctx> BundleDefault<Ctx> for Twhere
T: Default,
impl<T, Ctx> BundleDefault<Ctx> for Twhere
T: Default,
§fn default_with_context(_: Ctx) -> T
fn default_with_context(_: Ctx) -> T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more