mirror of https://github.com/helix-editor/helix
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
895 B
Rust
43 lines
895 B
Rust
#[macro_use]
|
|
pub mod macros;
|
|
|
|
pub mod clipboard;
|
|
pub mod document;
|
|
pub mod editor;
|
|
pub mod graphics;
|
|
pub mod gutter;
|
|
pub mod info;
|
|
pub mod input;
|
|
pub mod keyboard;
|
|
pub mod theme;
|
|
pub mod tree;
|
|
pub mod view;
|
|
|
|
use std::num::NonZeroUsize;
|
|
|
|
// uses NonZeroUsize so Option<DocumentId> use a byte rather than two
|
|
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
|
pub struct DocumentId(NonZeroUsize);
|
|
|
|
impl Default for DocumentId {
|
|
fn default() -> DocumentId {
|
|
// Safety: 1 is non-zero
|
|
DocumentId(unsafe { NonZeroUsize::new_unchecked(1) })
|
|
}
|
|
}
|
|
|
|
impl std::fmt::Display for DocumentId {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
f.write_fmt(format_args!("{}", self.0))
|
|
}
|
|
}
|
|
|
|
slotmap::new_key_type! {
|
|
pub struct ViewId;
|
|
}
|
|
|
|
pub use document::Document;
|
|
pub use editor::Editor;
|
|
pub use theme::Theme;
|
|
pub use view::View;
|