pub enum BlockRole {
Block,
Inline(InlineSpacing),
Displayed,
BlockDecorator(Placement),
}Expand description
The role of an occurrence in the block and paragraph structure: a block, inline content, a displayed item, or a block decorator.
The block-structure rewrite pass (crate::lang::rewrites::blocks) reads
it to cut content into blocks: the pass begins a new block at each Block
node and at each paragraph break, keeps Inline and Displayed nodes
inside the surrounding block, and attaches a BlockDecorator to the block
it occurs in. The pass removes the whitespace on both sides of a
Displayed node, as it does beside an Inline node whose
InlineSpacing absorbs the whitespace on both sides. When the pass trims
the whitespace at the edges of a block, it looks past a decorator, so a
decorator at an edge does not keep the whitespace beside it.
An element that declares no BlockRoleAspect has BlockRole::DEFAULT;
read an occurrence’s role with block_role_of.
Variants§
Block
A block of its own, between paragraphs.
Inline(InlineSpacing)
Inline content inside a block, with the whitespace beside it treated as
the InlineSpacing says.
Displayed
A displayed item: a node that stands in inline content (a paragraph, or any content region laid out inline) and is set on lines of its own, with the whitespace beside it removed, such as a display equation. A displayed item continues the paragraph it stands in, and may hold anything: its own lowering rule lays its content out.
BlockDecorator(Placement)
Attached to the block it occurs in, at the Placement given.
Implementations§
Trait Implementations§
impl Copy for BlockRole
Source§impl<'de> Deserialize<'de> for BlockRole
impl<'de> Deserialize<'de> for BlockRole
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for BlockRole
Source§impl JsonSchema for BlockRole
impl JsonSchema for BlockRole
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreimpl StructuralPartialEq for BlockRole
Auto Trait Implementations§
impl Forget for BlockRole
impl Freeze for BlockRole
impl Move for BlockRole
impl RefUnwindSafe for BlockRole
impl Send for BlockRole
impl Sync for BlockRole
impl Unpin for BlockRole
impl UnsafeUnpin for BlockRole
impl UnwindSafe for BlockRole
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more