2021-06-18 00:09:10 +02:00
|
|
|
#[macro_use]
|
|
|
|
pub mod macros;
|
|
|
|
|
2021-06-14 23:37:17 +02:00
|
|
|
pub mod clipboard;
|
2020-10-22 07:35:07 +02:00
|
|
|
pub mod document;
|
2020-10-16 05:29:22 +02:00
|
|
|
pub mod editor;
|
2021-06-25 05:58:15 +02:00
|
|
|
pub mod graphics;
|
2021-11-23 04:56:46 +01:00
|
|
|
pub mod gutter;
|
2021-06-19 17:54:37 +02:00
|
|
|
pub mod info;
|
2021-06-22 19:04:04 +02:00
|
|
|
pub mod input;
|
2021-06-25 05:58:15 +02:00
|
|
|
pub mod keyboard;
|
2020-09-21 11:24:16 +02:00
|
|
|
pub mod theme;
|
2021-02-03 11:36:54 +01:00
|
|
|
pub mod tree;
|
2020-09-21 11:24:16 +02:00
|
|
|
pub mod view;
|
|
|
|
|
2021-11-25 03:07:23 +01: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 05:43:45 +01:00
|
|
|
|
2021-11-10 02:06:40 +01: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-22 19:04:04 +02:00
|
|
|
slotmap::new_key_type! {
|
|
|
|
pub struct ViewId;
|
|
|
|
}
|
2021-03-16 10:27:57 +01:00
|
|
|
|
2020-10-22 07:35:07 +02:00
|
|
|
pub use document::Document;
|
2020-10-16 05:29:22 +02:00
|
|
|
pub use editor::Editor;
|
2020-10-19 10:18:03 +02:00
|
|
|
pub use theme::Theme;
|
2020-09-21 11:24:16 +02:00
|
|
|
pub use view::View;
|