2021-06-18 06:09:10 +08:00
|
|
|
#[macro_use]
|
|
|
|
pub mod macros;
|
|
|
|
|
2021-06-15 05:37:17 +08:00
|
|
|
pub mod clipboard;
|
2020-10-22 13:35:07 +08:00
|
|
|
pub mod document;
|
2020-10-16 11:29:22 +08:00
|
|
|
pub mod editor;
|
2021-06-25 11:58:15 +08:00
|
|
|
pub mod graphics;
|
2021-11-23 11:56:46 +08:00
|
|
|
pub mod gutter;
|
2021-06-19 23:54:37 +08:00
|
|
|
pub mod info;
|
2021-06-23 01:04:04 +08:00
|
|
|
pub mod input;
|
2021-06-25 11:58:15 +08:00
|
|
|
pub mod keyboard;
|
2020-09-21 17:24:16 +08:00
|
|
|
pub mod theme;
|
2021-02-03 18:36:54 +08:00
|
|
|
pub mod tree;
|
2020-09-21 17:24:16 +08:00
|
|
|
pub mod view;
|
|
|
|
|
2021-11-25 10:07:23 +08:00
|
|
|
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) })
|
|
|
|
}
|
|
|
|
}
|
2021-11-04 12:43:45 +08:00
|
|
|
|
2021-11-10 09:06:40 +08:00
|
|
|
impl std::fmt::Display for DocumentId {
|
|
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
|
|
f.write_fmt(format_args!("{}", self.0))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-23 01:04:04 +08:00
|
|
|
slotmap::new_key_type! {
|
|
|
|
pub struct ViewId;
|
|
|
|
}
|
2021-03-16 17:27:57 +08:00
|
|
|
|
2020-10-22 13:35:07 +08:00
|
|
|
pub use document::Document;
|
2020-10-16 11:29:22 +08:00
|
|
|
pub use editor::Editor;
|
2020-10-19 16:18:03 +08:00
|
|
|
pub use theme::Theme;
|
2020-09-21 17:24:16 +08:00
|
|
|
pub use view::View;
|