pub struct FoldRegionId(pub u64);Expand description
Packed identity for a fold region’s line range.
The representation is collision-free when both line indices fit in 32 bits.
Values outside that range are not rejected and can collide, so persistent
callers should keep both inputs at or below u32::MAX.
§Examples
use ailloli_ui_editor::FoldRegionId;
assert_eq!(FoldRegionId::from_lines(2, 9), FoldRegionId((2_u64 << 32) | 9));Tuple Fields§
§0: u64Implementations§
Source§impl FoldRegionId
Creates packed fold-region identifiers.
impl FoldRegionId
Creates packed fold-region identifiers.
Sourcepub fn from_lines(start_line: usize, end_line: usize) -> Self
pub fn from_lines(start_line: usize, end_line: usize) -> Self
Packs the start line into the high 32 bits and ORs in the end line.
Inputs are not range-checked. The identifier is uniquely reversible
only when both inputs fit in u32.
§Examples
use ailloli_ui_editor::FoldRegionId;
let id = FoldRegionId::from_lines(12, 34);
assert_eq!(id.0 >> 32, 12);
assert_eq!(id.0 as u32, 34);Trait Implementations§
Source§impl Clone for FoldRegionId
impl Clone for FoldRegionId
Source§fn clone(&self) -> FoldRegionId
fn clone(&self) -> FoldRegionId
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FoldRegionId
impl Debug for FoldRegionId
Source§impl<'de> Deserialize<'de> for FoldRegionId
impl<'de> Deserialize<'de> for FoldRegionId
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
Source§impl Hash for FoldRegionId
impl Hash for FoldRegionId
Source§impl PartialEq for FoldRegionId
impl PartialEq for FoldRegionId
Source§impl Serialize for FoldRegionId
impl Serialize for FoldRegionId
impl Copy for FoldRegionId
impl Eq for FoldRegionId
impl StructuralPartialEq for FoldRegionId
Auto Trait Implementations§
impl Freeze for FoldRegionId
impl RefUnwindSafe for FoldRegionId
impl Send for FoldRegionId
impl Sync for FoldRegionId
impl Unpin for FoldRegionId
impl UnwindSafe for FoldRegionId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.