pub struct BufferId(/* private fields */);Expand description
Unique identifier for a buffer.
Buffer IDs are monotonically increasing and never reused within a session. This ensures that buffer references remain unambiguous even after buffers are closed.
§Example
use reovim_kernel::api::v1::*;
let id1 = BufferId::new();
let id2 = BufferId::new();
assert_ne!(id1, id2);
assert!(id1 < id2);Implementations§
Source§impl BufferId
impl BufferId
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new unique buffer ID.
Each call returns a distinct ID, guaranteed to be unique within the current process lifetime.
Sourcepub const fn from_raw(value: usize) -> Self
pub const fn from_raw(value: usize) -> Self
Create a BufferId from a raw value.
This is primarily useful for testing or deserialization.
§Warning
Using this incorrectly may create duplicate IDs. Prefer BufferId::new
for normal usage.
Trait Implementations§
Source§impl Ord for BufferId
impl Ord for BufferId
Source§impl PartialOrd for BufferId
impl PartialOrd for BufferId
impl Copy for BufferId
impl Eq for BufferId
impl StructuralPartialEq for BufferId
Auto Trait Implementations§
impl Freeze for BufferId
impl RefUnwindSafe for BufferId
impl Send for BufferId
impl Sync for BufferId
impl Unpin for BufferId
impl UnsafeUnpin for BufferId
impl UnwindSafe for BufferId
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