Struct workspace::Workspace

source ·
pub struct Workspace { /* private fields */ }

Implementations§

source§

impl Workspace

source

pub fn has_shown_notification_once<V: Notification>( &self, id: usize, cx: &ViewContext<'_, '_, Self> ) -> bool

source

pub fn show_notification_once<V: Notification>( &mut self, id: usize, cx: &mut ViewContext<'_, '_, Self>, build_notification: impl FnOnce(&mut ViewContext<'_, '_, Self>) -> ViewHandle<V> )

source

pub fn show_notification<V: Notification>( &mut self, id: usize, cx: &mut ViewContext<'_, '_, Self>, build_notification: impl FnOnce(&mut ViewContext<'_, '_, Self>) -> ViewHandle<V> )

source

pub fn dismiss_notification<V: Notification>( &mut self, id: usize, cx: &mut ViewContext<'_, '_, Self> )

source

pub fn show_toast(&mut self, toast: Toast, cx: &mut ViewContext<'_, '_, Self>)

source

pub fn dismiss_toast(&mut self, id: usize, cx: &mut ViewContext<'_, '_, Self>)

source§

impl Workspace

source

pub fn new( workspace_id: WorkspaceId, project: ModelHandle<Project>, app_state: Arc<AppState>, cx: &mut ViewContext<'_, '_, Self> ) -> Self

source

pub fn weak_handle(&self) -> WeakViewHandle<Self>

source

pub fn left_dock(&self) -> &ViewHandle<Dock>

source

pub fn bottom_dock(&self) -> &ViewHandle<Dock>

source

pub fn right_dock(&self) -> &ViewHandle<Dock>

source

pub fn add_panel<T: Panel>( &mut self, panel: ViewHandle<T>, cx: &mut ViewContext<'_, '_, Self> )where T::Event: Debug,

source

pub fn add_panel_with_extra_event_handler<T: Panel, F>( &mut self, panel: ViewHandle<T>, cx: &mut ViewContext<'_, '_, Self>, handler: F )where T::Event: Debug, F: Fn(&mut Self, &ViewHandle<T>, &T::Event, &mut ViewContext<'_, '_, Self>) + 'static,

source

pub fn status_bar(&self) -> &ViewHandle<StatusBar>

source

pub fn app_state(&self) -> &Arc<AppState>

source

pub fn user_store(&self) -> &ModelHandle<UserStore>

source

pub fn project(&self) -> &ModelHandle<Project>

source

pub fn recent_navigation_history( &self, limit: Option<usize>, cx: &AppContext ) -> Vec<(ProjectPath, Option<PathBuf>)>

source

pub fn go_back( &mut self, pane: WeakViewHandle<Pane>, cx: &mut ViewContext<'_, '_, Workspace> ) -> Task<Result<()>>

source

pub fn go_forward( &mut self, pane: WeakViewHandle<Pane>, cx: &mut ViewContext<'_, '_, Workspace> ) -> Task<Result<()>>

source

pub fn reopen_closed_item( &mut self, cx: &mut ViewContext<'_, '_, Workspace> ) -> Task<Result<()>>

source

pub fn client(&self) -> &Client

source

pub fn set_titlebar_item( &mut self, item: AnyViewHandle, cx: &mut ViewContext<'_, '_, Self> )

source

pub fn titlebar_item(&self) -> Option<AnyViewHandle>

source

pub fn with_local_workspace<T, F>( &mut self, cx: &mut ViewContext<'_, '_, Self>, callback: F ) -> Task<Result<T>>where T: 'static, F: 'static + FnOnce(&mut Workspace, &mut ViewContext<'_, '_, Workspace>) -> T,

Call the given callback with a workspace whose project is local.

If the given workspace has a local project, then it will be passed to the callback. Otherwise, a new empty window will be created.

source

pub fn worktrees<'a>( &self, cx: &'a AppContext ) -> impl 'a + Iterator<Item = ModelHandle<Worktree>>

source

pub fn visible_worktrees<'a>( &self, cx: &'a AppContext ) -> impl 'a + Iterator<Item = ModelHandle<Worktree>>

source

pub fn worktree_scans_complete( &self, cx: &AppContext ) -> impl Future<Output = ()> + 'static

source

pub fn close_global(_: &CloseWindow, cx: &mut AppContext)

source

pub fn close( &mut self, _: &CloseWindow, cx: &mut ViewContext<'_, '_, Self> ) -> Option<Task<Result<()>>>

source

pub fn prepare_to_close( &mut self, quitting: bool, cx: &mut ViewContext<'_, '_, Self> ) -> Task<Result<bool>>

source

pub fn open( &mut self, _: &Open, cx: &mut ViewContext<'_, '_, Self> ) -> Option<Task<Result<()>>>

source

pub fn open_workspace_for_paths( &mut self, paths: Vec<PathBuf>, cx: &mut ViewContext<'_, '_, Self> ) -> Task<Result<()>>

source

pub fn open_paths( &mut self, abs_paths: Vec<PathBuf>, visible: bool, cx: &mut ViewContext<'_, '_, Self> ) -> Task<Vec<Option<Result<Box<dyn ItemHandle>, Error>>>>

source

pub fn toggle_modal<V, F>( &mut self, cx: &mut ViewContext<'_, '_, Self>, add_view: F ) -> Option<ViewHandle<V>>where V: 'static + Modal, F: FnOnce(&mut Self, &mut ViewContext<'_, '_, Self>) -> ViewHandle<V>,

Returns the modal that was toggled closed if it was open.

source

pub fn modal<V: 'static + View>(&self) -> Option<ViewHandle<V>>

source

pub fn dismiss_modal( &mut self, cx: &mut ViewContext<'_, '_, Self> ) -> Option<AnyViewHandle>

source

pub fn items<'a>( &'a self, cx: &'a AppContext ) -> impl 'a + Iterator<Item = &Box<dyn ItemHandle>>

source

pub fn item_of_type<T: Item>(&self, cx: &AppContext) -> Option<ViewHandle<T>>

source

pub fn items_of_type<'a, T: Item>( &'a self, cx: &'a AppContext ) -> impl 'a + Iterator<Item = ViewHandle<T>>

source

pub fn active_item(&self, cx: &AppContext) -> Option<Box<dyn ItemHandle>>

source

pub fn save_active_item( &mut self, save_intent: SaveIntent, cx: &mut ViewContext<'_, '_, Self> ) -> Task<Result<()>>

source

pub fn close_inactive_items_and_panes( &mut self, _: &CloseInactiveTabsAndPanes, cx: &mut ViewContext<'_, '_, Self> ) -> Option<Task<Result<()>>>

source

pub fn close_all_items_and_panes( &mut self, action: &CloseAllItemsAndPanes, cx: &mut ViewContext<'_, '_, Self> ) -> Option<Task<Result<()>>>

source

pub fn toggle_dock( &mut self, dock_side: DockPosition, cx: &mut ViewContext<'_, '_, Self> )

source

pub fn close_all_docks(&mut self, cx: &mut ViewContext<'_, '_, Self>)

source

pub fn focus_panel<T: Panel>( &mut self, cx: &mut ViewContext<'_, '_, Self> ) -> Option<ViewHandle<T>>

Transfer focus to the panel of the given type.

source

pub fn toggle_panel_focus<T: Panel>( &mut self, cx: &mut ViewContext<'_, '_, Self> )

Focus the panel of the given type if it isn’t already focused. If it is already focused, then transfer focus back to the workspace center.

source

pub fn panel<T: Panel>(&self, cx: &WindowContext<'_>) -> Option<ViewHandle<T>>

source

pub fn add_item_to_center( &mut self, item: Box<dyn ItemHandle>, cx: &mut ViewContext<'_, '_, Self> ) -> bool

source

pub fn add_item( &mut self, item: Box<dyn ItemHandle>, cx: &mut ViewContext<'_, '_, Self> )

source

pub fn split_item( &mut self, split_direction: SplitDirection, item: Box<dyn ItemHandle>, cx: &mut ViewContext<'_, '_, Self> )

source

pub fn open_abs_path( &mut self, abs_path: PathBuf, visible: bool, cx: &mut ViewContext<'_, '_, Self> ) -> Task<Result<Box<dyn ItemHandle>>>

source

pub fn split_abs_path( &mut self, abs_path: PathBuf, visible: bool, cx: &mut ViewContext<'_, '_, Self> ) -> Task<Result<Box<dyn ItemHandle>>>

source

pub fn open_path( &mut self, path: impl Into<ProjectPath>, pane: Option<WeakViewHandle<Pane>>, focus_item: bool, cx: &mut ViewContext<'_, '_, Self> ) -> Task<Result<Box<dyn ItemHandle>, Error>>

source

pub fn split_path( &mut self, path: impl Into<ProjectPath>, cx: &mut ViewContext<'_, '_, Self> ) -> Task<Result<Box<dyn ItemHandle>, Error>>

source

pub fn open_project_item<T>( &mut self, project_item: ModelHandle<T::Item>, cx: &mut ViewContext<'_, '_, Self> ) -> ViewHandle<T>where T: ProjectItem,

source

pub fn split_project_item<T>( &mut self, project_item: ModelHandle<T::Item>, cx: &mut ViewContext<'_, '_, Self> ) -> ViewHandle<T>where T: ProjectItem,

source

pub fn open_shared_screen( &mut self, peer_id: PeerId, cx: &mut ViewContext<'_, '_, Self> )

source

pub fn activate_item( &mut self, item: &dyn ItemHandle, cx: &mut ViewContext<'_, '_, Self> ) -> bool

source

pub fn activate_next_pane(&mut self, cx: &mut ViewContext<'_, '_, Self>)

source

pub fn activate_previous_pane(&mut self, cx: &mut ViewContext<'_, '_, Self>)

source

pub fn activate_pane_in_direction( &mut self, direction: SplitDirection, cx: &mut ViewContext<'_, '_, Self> )

source

pub fn swap_pane_in_direction( &mut self, direction: SplitDirection, cx: &mut ViewContext<'_, '_, Self> )

source

pub fn split_pane( &mut self, pane_to_split: ViewHandle<Pane>, split_direction: SplitDirection, cx: &mut ViewContext<'_, '_, Self> ) -> ViewHandle<Pane>

source

pub fn split_and_clone( &mut self, pane: ViewHandle<Pane>, direction: SplitDirection, cx: &mut ViewContext<'_, '_, Self> ) -> Option<ViewHandle<Pane>>

source

pub fn split_pane_with_item( &mut self, pane_to_split: WeakViewHandle<Pane>, split_direction: SplitDirection, from: WeakViewHandle<Pane>, item_id_to_move: usize, cx: &mut ViewContext<'_, '_, Self> )

source

pub fn split_pane_with_project_entry( &mut self, pane_to_split: WeakViewHandle<Pane>, split_direction: SplitDirection, project_entry: ProjectEntryId, cx: &mut ViewContext<'_, '_, Self> ) -> Option<Task<Result<()>>>

source

pub fn move_item( &mut self, source: ViewHandle<Pane>, destination: ViewHandle<Pane>, item_id_to_move: usize, destination_index: usize, cx: &mut ViewContext<'_, '_, Self> )

source

pub fn panes(&self) -> &[ViewHandle<Pane>]

source

pub fn active_pane(&self) -> &ViewHandle<Pane>

source

pub fn follow_next_collaborator( &mut self, _: &FollowNextCollaborator, cx: &mut ViewContext<'_, '_, Self> ) -> Option<Task<Result<()>>>

source

pub fn follow( &mut self, leader_id: PeerId, cx: &mut ViewContext<'_, '_, Self> ) -> Option<Task<Result<()>>>

source

pub fn unfollow( &mut self, pane: &ViewHandle<Pane>, cx: &mut ViewContext<'_, '_, Self> ) -> Option<PeerId>

source

pub fn is_being_followed(&self, peer_id: PeerId) -> bool

source

pub fn leader_for_pane(&self, pane: &ViewHandle<Pane>) -> Option<PeerId>

source

pub fn on_window_activation_changed( &mut self, active: bool, cx: &mut ViewContext<'_, '_, Self> )

source

pub fn database_id(&self) -> WorkspaceId

Trait Implementations§

source§

impl Entity for Workspace

§

type Event = Event

source§

fn release(&mut self, cx: &mut AppContext)

§

fn app_will_quit( &mut self, _: &mut AppContext ) -> Option<Pin<Box<dyn Future<Output = ()>, Global>>>

source§

impl View for Workspace

source§

fn ui_name() -> &'static str

source§

fn render(&mut self, cx: &mut ViewContext<'_, '_, Self>) -> AnyElement<Self>

source§

fn focus_in(&mut self, _: AnyViewHandle, cx: &mut ViewContext<'_, '_, Self>)

source§

fn modifiers_changed( &mut self, e: &ModifiersChangedEvent, cx: &mut ViewContext<'_, '_, Self> ) -> bool

§

fn focus_out(&mut self, _: AnyViewHandle, _: &mut ViewContext<'_, '_, Self>)

§

fn key_down( &mut self, _: &KeyDownEvent, _: &mut ViewContext<'_, '_, Self> ) -> bool

§

fn key_up(&mut self, _: &KeyUpEvent, _: &mut ViewContext<'_, '_, Self>) -> bool

§

fn update_keymap_context(&self, keymap: &mut KeymapContext, _: &AppContext)

§

fn reset_to_default_keymap_context(keymap: &mut KeymapContext)

§

fn debug_json(&self, _: &AppContext) -> Value

§

fn text_for_range(&self, _: Range<usize>, _: &AppContext) -> Option<String>

§

fn selected_text_range(&self, _: &AppContext) -> Option<Range<usize>>

§

fn marked_text_range(&self, _: &AppContext) -> Option<Range<usize>>

§

fn unmark_text(&mut self, _: &mut ViewContext<'_, '_, Self>)

§

fn replace_text_in_range( &mut self, _: Option<Range<usize>>, _: &str, _: &mut ViewContext<'_, '_, Self> )

§

fn replace_and_mark_text_in_range( &mut self, _: Option<Range<usize>>, _: &str, _: Option<Range<usize>>, _: &mut ViewContext<'_, '_, Self> )

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AnyModel for Twhere T: Entity,

§

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

§

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

§

fn release(&mut self, cx: &mut AppContext)

§

fn app_will_quit( &mut self, cx: &mut AppContext ) -> Option<Pin<Box<dyn Future<Output = ()>, Global>>>

§

impl<V> AnyView for Vwhere V: View,

§

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

§

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

§

fn release(&mut self, cx: &mut AppContext)

§

fn app_will_quit( &mut self, cx: &mut AppContext ) -> Option<Pin<Box<dyn Future<Output = ()>, Global>>>

§

fn ui_name(&self) -> &'static str

§

fn render( &mut self, cx: &mut WindowContext<'_>, view_id: usize ) -> Box<dyn AnyRootElement, Global>

§

fn focus_in( &mut self, focused_id: usize, cx: &mut WindowContext<'_>, view_id: usize )

§

fn focus_out( &mut self, blurred_id: usize, cx: &mut WindowContext<'_>, view_id: usize )

§

fn key_down( &mut self, event: &KeyDownEvent, cx: &mut WindowContext<'_>, view_id: usize ) -> bool

§

fn key_up( &mut self, event: &KeyUpEvent, cx: &mut WindowContext<'_>, view_id: usize ) -> bool

§

fn modifiers_changed( &mut self, event: &ModifiersChangedEvent, cx: &mut WindowContext<'_>, view_id: usize ) -> bool

§

fn update_keymap_context(&self, keymap: &mut KeymapContext, cx: &AppContext)

§

fn debug_json(&self, cx: &WindowContext<'_>) -> Value

§

fn text_for_range( &self, range: Range<usize>, cx: &WindowContext<'_> ) -> Option<String>

§

fn selected_text_range(&self, cx: &WindowContext<'_>) -> Option<Range<usize>>

§

fn marked_text_range(&self, cx: &WindowContext<'_>) -> Option<Range<usize>>

§

fn unmark_text(&mut self, cx: &mut WindowContext<'_>, view_id: usize)

§

fn replace_text_in_range( &mut self, range: Option<Range<usize>>, text: &str, cx: &mut WindowContext<'_>, view_id: usize )

§

fn replace_and_mark_text_in_range( &mut self, range: Option<Range<usize>>, new_text: &str, new_selected_range: Option<Range<usize>>, cx: &mut WindowContext<'_>, view_id: usize )

§

fn any_handle( &self, window: AnyWindowHandle, view_id: usize, cx: &AppContext ) -> AnyViewHandle

source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<T, U> ToSample<U> for Twhere U: FromSample<T>,

§

fn to_sample_(self) -> U

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<S, T> Duplex<S> for Twhere T: FromSample<S> + ToSample<S>,