pub struct Region {
pub name: Name,
pub piece: Option<PiecePlace>,
pub parts: Vec<String>,
pub words: Option<String>,
}Expand description
One output region: its name, whether it is a piece, its parts, and the plain words of a piece or of the HTML title and language.
Build one with Region::new, Region::with_words or
Region::piece. A backend’s regions stage pushes the regions of its
output into a Regions table.
Fields§
§name: NameThe region’s name: one of the names in the module documentation, or a piece’s name.
piece: Option<PiecePlace>Where the piece is placed, when the region is a piece; None for every
other region.
parts: Vec<String>The region’s parts, in order, each written by the backend in its output format (see the module documentation).
words: Option<String>The region’s words: its displayed characters as plain text, for a
place in the entry artifact where no markup is allowed, such as the
title of an HTML page or the value of an attribute. Set for a piece and
for the HTML regions TITLE and LANG; None for every other
region.
Implementations§
Source§impl Region
impl Region
Sourcepub fn new(name: impl Into<Name>, parts: Vec<String>) -> Region
pub fn new(name: impl Into<Name>, parts: Vec<String>) -> Region
Returns a region named name holding parts, which is not a piece
and has no words.
Sourcepub fn piece(
name: impl Into<Name>,
place: PiecePlace,
parts: Vec<String>,
words: String,
) -> Region
pub fn piece( name: impl Into<Name>, place: PiecePlace, parts: Vec<String>, words: String, ) -> Region
Returns the region of the piece name, placed at place, holding
parts, with the words words (computed by piece_words).
Sourcepub fn text(&self) -> String
pub fn text(&self) -> String
Returns the region as one text: its parts joined by line breaks.
§Examples
use flm_core::core::region::Region;
let region = Region::new("styles", vec![String::from("<style>a</style>"), String::from("<style>b</style>")]);
assert_eq!(region.text(), "<style>a</style>\n<style>b</style>");Trait Implementations§
impl Eq for Region
impl StructuralPartialEq for Region
Auto Trait Implementations§
impl Forget for Region
impl Freeze for Regionwhere
*const ArcInner<str> is !null: Freeze,
PhantomData<ArcInner<str>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<String>: Freeze,
PhantomData<u8>: Freeze,
impl Move for Region
impl RefUnwindSafe for Region
impl Send for Region
impl Sync for Region
impl Unpin for Region
impl UnsafeUnpin for Regionwhere
*const ArcInner<str> is !null: UnsafeUnpin,
PhantomData<ArcInner<str>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
impl UnwindSafe for Region
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,
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