compose_rt/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#![allow(clippy::new_without_default)]

mod loc;
pub use loc::Loc;

mod composer;
pub use composer::{Composable, ComposeNode, Composer, NodeKey, Recomposer};

mod state;
pub use state::{State, StateId};

mod scope;
pub use scope::{AnyData, Root, Scope, ScopeId};

pub mod utils;

mod map;

const ANCHOR: Loc = Loc::new();

#[track_caller]
#[inline(always)]
pub(crate) fn offset_to_anchor() -> i64 {
    let anchor = ANCHOR.id() as i64;
    let loc = Loc::new().id() as i64;
    anchor - loc
}