pub struct FsUri {
pub uri: String,
pub document_top_tree_uri: Option<String>,
}Expand description
URI for a file or directory.
§Note
Serialized by serde as:
type AndroidFsUri = {
uri: string,
documentTopTreeUri: string | null
}Fields§
§uri: String§document_top_tree_uri: Option<String>Document tree URI of the root directory from which this entry originates.
§Note
This field is set for directories obtained via Directory Picker and for entries derived from those directories.
Implementations§
Source§impl FsUri
impl FsUri
Sourcepub fn to_json_string(&self) -> Result<String>
pub fn to_json_string(&self) -> Result<String>
Same as serde_json::to_string()
Sourcepub fn from_json_str(json: impl AsRef<str>) -> Result<Self>
pub fn from_json_str(json: impl AsRef<str>) -> Result<Self>
Same as serde_json::from_str()
pub fn from_uri(uri: impl Into<String>) -> Self
Sourcepub fn from_path(path: impl AsRef<Path>) -> Self
pub fn from_path(path: impl AsRef<Path>) -> Self
Constructs a URI from the absolute path of a file or directory.
§Note
The path must be absolute and must not contain ./ or ../.
Even if the path is invalid, this function will not return an error or panic;
instead, it returns an invalid URI.
Note the following:
Sourcepub fn to_path(&self) -> Option<PathBuf>
pub fn to_path(&self) -> Option<PathBuf>
Returns the path if this URI uses the file scheme;
otherwise, returns None.
Sourcepub fn is_file_scheme(&self) -> bool
pub fn is_file_scheme(&self) -> bool
Returns true if this URI uses the file scheme.
Sourcepub fn is_content_scheme(&self) -> bool
pub fn is_content_scheme(&self) -> bool
Returns true if this URI uses the content scheme.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for FsUri
impl<'de> Deserialize<'de> for FsUri
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for FsUri
impl StructuralPartialEq for FsUri
Auto Trait Implementations§
impl Freeze for FsUri
impl RefUnwindSafe for FsUri
impl Send for FsUri
impl Sync for FsUri
impl Unpin for FsUri
impl UnsafeUnpin for FsUri
impl UnwindSafe for FsUri
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
Mutably borrows from an owned value. Read more