pub struct StudyEditor { /* private fields */ }Expand description
The study editor panel.
Implementations§
Source§impl StudyEditor
impl StudyEditor
Sourcepub fn open_document(
&mut self,
title: impl Into<String>,
text: impl Into<String>,
)
pub fn open_document( &mut self, title: impl Into<String>, text: impl Into<String>, )
Replaces the document, clearing diagnostics and status and the modified state.
Sourcepub fn is_modified(&self) -> bool
pub fn is_modified(&self) -> bool
Whether the text differs from the text last opened or saved.
Sourcepub fn mark_saved(&mut self, text: &str)
pub fn mark_saved(&mut self, text: &str)
Records that the host stored text, which clears the modified state if the user has not
edited the document since the save request.
Sourcepub fn set_diagnostics(&mut self, diagnostics: Vec<Diagnostic>)
pub fn set_diagnostics(&mut self, diagnostics: Vec<Diagnostic>)
Replaces the diagnostics shown, most serious first as the host sends them.
Sourcepub fn diagnostics(&self) -> &[Diagnostic]
pub fn diagnostics(&self) -> &[Diagnostic]
The diagnostics shown.
Sourcepub fn apply_result(&mut self, result: Result<(), String>)
pub fn apply_result(&mut self, result: Result<(), String>)
Records the host’s answer to StudyEditorAction::Apply: Ok shows the text as applied,
Err shows the reason. Neither changes the text.
Sourcepub fn reveal(&mut self, span: Range<usize>)
pub fn reveal(&mut self, span: Range<usize>)
Selects the byte span in the text and scrolls to it in the next frame.
Sourcepub fn show(&mut self, ui: &mut Ui) -> StudyEditorAction
pub fn show(&mut self, ui: &mut Ui) -> StudyEditorAction
Shows the panel in ui and returns what the user asked of the host.
Trait Implementations§
Source§impl Default for StudyEditor
impl Default for StudyEditor
Source§fn default() -> StudyEditor
fn default() -> StudyEditor
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StudyEditor
impl RefUnwindSafe for StudyEditor
impl Send for StudyEditor
impl Sync for StudyEditor
impl Unpin for StudyEditor
impl UnsafeUnpin for StudyEditor
impl UnwindSafe for StudyEditor
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more