pub struct StorageBookmarkHelper;Expand description
In order to have unique bookmarks across platforms, we prepend a platform specific suffix before native bookmark. And always encoding them in base64 before returning to the user.
Bookmarks are encoded as: 0-6 - framework prefix with version number 7-15 - platform key 16+ - native bookmark value Which is then encoded in Base64.
This is an implementation detail of the platform backends.
Implementations§
Source§impl StorageBookmarkHelper
impl StorageBookmarkHelper
Sourcepub fn encode_bookmark(
platform: &[u8],
native_bookmark: Option<&str>,
) -> Option<String>
pub fn encode_bookmark( platform: &[u8], native_bookmark: Option<&str>, ) -> Option<String>
Encodes the text of a native bookmark of the given platform; None
for no bookmark and for an empty one.
§Panics
Sourcepub fn encode_bookmark_bytes(
platform: &[u8],
native_bookmark_bytes: &[u8],
) -> Option<String>
pub fn encode_bookmark_bytes( platform: &[u8], native_bookmark_bytes: &[u8], ) -> Option<String>
Encodes a native bookmark of the given platform; None for an empty
one.
§Panics
Panics when the platform name is longer than the header, or does not fit in the encoded bookmark.
Sourcepub fn try_decode_bookmark(
platform: &[u8],
base64_bookmark: Option<&str>,
) -> (DecodeResult, Option<Vec<u8>>)
pub fn try_decode_bookmark( platform: &[u8], base64_bookmark: Option<&str>, ) -> (DecodeResult, Option<Vec<u8>>)
Decodes a bookmark of the given platform into its native bookmark.
The native bookmark is Some exactly when the result is
DecodeResult::Success.
Sourcepub fn encode_bcl_bookmark(local_path: &str) -> String
pub fn encode_bcl_bookmark(local_path: &str) -> String
Encodes the local path of a file-system backed storage item as a bookmark.
§Panics
Panics when the path is empty.
Sourcepub fn try_decode_bcl_bookmark(native_bookmark: &str) -> Option<String>
pub fn try_decode_bcl_bookmark(native_bookmark: &str) -> Option<String>
Decodes the bookmark of a file-system backed storage item into its local path. Bookmarks of the format used before bookmarks were encoded (plain paths) are accepted too.
Auto Trait Implementations§
impl Freeze for StorageBookmarkHelper
impl RefUnwindSafe for StorageBookmarkHelper
impl Send for StorageBookmarkHelper
impl Sync for StorageBookmarkHelper
impl Unpin for StorageBookmarkHelper
impl UnsafeUnpin for StorageBookmarkHelper
impl UnwindSafe for StorageBookmarkHelper
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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more