mirror of https://github.com/boa-dev/boa.git
Browse Source
* Implement type safe root object shape * Implement `From` for Unique and Shared shapespull/2947/head
Haled Odat
2 years ago
committed by
GitHub
14 changed files with 104 additions and 62 deletions
@ -0,0 +1,27 @@
|
||||
use boa_macros::{Finalize, Trace}; |
||||
|
||||
use super::SharedShape; |
||||
|
||||
/// This is a wrapper around [`SharedShape`] that ensures it's root shape.
|
||||
///
|
||||
/// Represent the root shape that [`SharedShape`] transitions start from.
|
||||
#[derive(Debug, Clone, Trace, Finalize)] |
||||
pub struct RootShape { |
||||
shape: SharedShape, |
||||
} |
||||
|
||||
impl Default for RootShape { |
||||
#[inline] |
||||
fn default() -> Self { |
||||
Self { |
||||
shape: SharedShape::root(), |
||||
} |
||||
} |
||||
} |
||||
|
||||
impl RootShape { |
||||
/// Gets the inner [`SharedShape`].
|
||||
pub const fn shape(&self) -> &SharedShape { |
||||
&self.shape |
||||
} |
||||
} |
Loading…
Reference in new issue