Skip to main content

FsUri

Struct FsUri 

Source
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

URI for a file or directory.

§Note

This is a URI with either the content or file scheme.

§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

Source

pub fn to_json_string(&self) -> Result<String>

Same as serde_json::to_string()

Source

pub fn from_json_str(json: impl AsRef<str>) -> Result<Self>

Same as serde_json::from_str()

Source

pub fn from_uri(uri: impl Into<String>) -> Self

Source

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:

  • This URI cannot be used with Opener to open files in other apps.
  • Operations using this URI may fall back to std::fs instead of the Kotlin API.
Source

pub fn to_path(&self) -> Option<PathBuf>

Returns the path if this URI uses the file scheme; otherwise, returns None.

Source

pub fn is_file_scheme(&self) -> bool

Returns true if this URI uses the file scheme.

Source

pub fn is_content_scheme(&self) -> bool

Returns true if this URI uses the content scheme.

Trait Implementations§

Source§

impl Clone for FsUri

Source§

fn clone(&self) -> FsUri

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FsUri

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for FsUri

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for FsUri

Source§

impl From<&Path> for FsUri

Source§

fn from(path: &Path) -> Self

Converts to this type from the input type.
Source§

impl From<&PathBuf> for FsUri

Source§

fn from(path: &PathBuf) -> Self

Converts to this type from the input type.
Source§

impl From<FilePath> for FsUri

Source§

fn from(value: FilePath) -> Self

Converts to this type from the input type.
Source§

impl From<FsUri> for FilePath

Source§

fn from(value: FsUri) -> Self

Converts to this type from the input type.
Source§

impl From<PathBuf> for FsUri

Source§

fn from(path: PathBuf) -> Self

Converts to this type from the input type.
Source§

impl Hash for FsUri

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FsUri

Source§

fn eq(&self, other: &FsUri) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for FsUri

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

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> 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<'de, D, R> CommandArg<'de, R> for D
where D: Deserialize<'de>, R: Runtime,

Source§

fn from_command(command: CommandItem<'de, R>) -> Result<D, InvokeError>

Derives an instance of Self from the CommandItem. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> ErasedDestructor for T
where T: 'static,

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> IpcResponse for T
where T: Serialize,

Source§

fn body(self) -> Result<InvokeResponseBody, Error>

Resolve the IPC response body.
Source§

impl<T> ScopeObject for T
where T: Send + Sync + Debug + DeserializeOwned + 'static,

Source§

type Error = Error

The error type.
Source§

fn deserialize<R>( _app: &AppHandle<R>, raw: Value, ) -> Result<T, <T as ScopeObject>::Error>
where R: Runtime,

Deserialize the raw scope value.
Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> UserEvent for T
where T: Debug + Clone + Send + 'static,