Trait zed2::languages::File

source ·
pub trait File: Send + Sync {
    // Required methods
    fn as_local(&self) -> Option<&dyn LocalFile>;
    fn mtime(&self) -> SystemTime;
    fn path(&self) -> &Arc<Path, Global>;
    fn full_path(&self, cx: &AppContext) -> PathBuf;
    fn file_name<'a>(&'a self, cx: &'a AppContext) -> &'a OsStr;
    fn worktree_id(&self) -> usize;
    fn is_deleted(&self) -> bool;
    fn as_any(&self) -> &(dyn Any + 'static);
    fn to_proto(&self) -> File;

    // Provided method
    fn is_local(&self) -> bool { ... }
}

Required Methods§

source

fn as_local(&self) -> Option<&dyn LocalFile>

source

fn mtime(&self) -> SystemTime

source

fn path(&self) -> &Arc<Path, Global>

Returns the path of this file relative to the worktree’s root directory.

source

fn full_path(&self, cx: &AppContext) -> PathBuf

Returns the path of this file relative to the worktree’s parent directory (this means it includes the name of the worktree’s root folder).

source

fn file_name<'a>(&'a self, cx: &'a AppContext) -> &'a OsStr

Returns the last component of this handle’s absolute path. If this handle refers to the root of its worktree, then this method will return the name of the worktree itself.

source

fn worktree_id(&self) -> usize

Returns the id of the worktree to which this file belongs.

This is needed for looking up project-specific settings.

source

fn is_deleted(&self) -> bool

source

fn as_any(&self) -> &(dyn Any + 'static)

source

fn to_proto(&self) -> File

Provided Methods§

source

fn is_local(&self) -> bool

Implementations on Foreign Types§

source§

impl File for File

source§

fn file_name<'a>(&'a self, cx: &'a AppContext) -> &'a OsStr

Returns the last component of this handle’s absolute path. If this handle refers to the root of its worktree, then this method will return the name of the worktree itself.

source§

fn as_local(&self) -> Option<&dyn LocalFile>

source§

fn mtime(&self) -> SystemTime

source§

fn path(&self) -> &Arc<Path, Global>

source§

fn full_path(&self, cx: &AppContext) -> PathBuf

source§

fn worktree_id(&self) -> usize

source§

fn is_deleted(&self) -> bool

source§

fn as_any(&self) -> &(dyn Any + 'static)

source§

fn to_proto(&self) -> File

Implementors§