pub struct Viewport {
pub top_line: u32,
pub left_column: u32,
pub visible_lines: u32,
pub visible_columns: u32,
}Fields§
§top_line: u32§left_column: u32§visible_lines: u32§visible_columns: u32Implementations§
Source§impl Viewport
impl Viewport
Sourcepub fn scroll_to_contain(self, p: Position, margin: u32) -> Self
pub fn scroll_to_contain(self, p: Position, margin: u32) -> Self
Scroll both axes so p is visible within this viewport, keeping at
least margin lines/columns of context on each edge where room
allows. The same margin applies to both axes. All arithmetic is
saturating, so the viewport never scrolls past 0 and a position
at the very top/left is clamped flush to the origin.
Pairing this with the editor’s single cursor-mutation path makes “cursor outside its viewport” an unrepresentable state: every move re-derives the viewport from the (clamped) cursor.
Trait Implementations§
impl Copy for Viewport
Source§impl<'de> Deserialize<'de> for Viewport
impl<'de> Deserialize<'de> for Viewport
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 Viewport
Source§impl JsonSchema for Viewport
impl JsonSchema for Viewport
Source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the
$ref keyword. Read moreimpl StructuralPartialEq for Viewport
Auto Trait Implementations§
impl Freeze for Viewport
impl RefUnwindSafe for Viewport
impl Send for Viewport
impl Sync for Viewport
impl Unpin for Viewport
impl UnsafeUnpin for Viewport
impl UnwindSafe for Viewport
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