pub struct InlineText {
pub segments: Vec<InlineSegment>,
}Expand description
A sequence of inline segments that compose a single <hp:t> element
with mixed content.
segments is normalized so adjacent InlineSegment::Plain entries
are merged. Callers that only need the plain-text equivalent (no tab
attributes) can use InlineText::plain_text which renders each
InlineSegment::Tab as a \t character.
Fields§
§segments: Vec<InlineSegment>Ordered inline segments. Always non-empty for a meaningful run;
projection that produces an empty InlineText should emit
RunContent::Text(String::new()) instead.
Implementations§
Source§impl InlineText
impl InlineText
Sourcepub fn from_segments(segments: impl IntoIterator<Item = InlineSegment>) -> Self
pub fn from_segments(segments: impl IntoIterator<Item = InlineSegment>) -> Self
Constructs an InlineText from raw segments, dropping empty
Plain runs and merging adjacent ones to keep the canonical
form predictable for equality comparisons and HWPX emit.
Sourcepub fn plain_text(&self) -> String
pub fn plain_text(&self) -> String
Returns the plain-text equivalent: each InlineSegment::Tab
becomes a \t character. Useful for callers (Markdown bridge,
CLI search, etc.) that cannot represent tab attributes.
Sourcepub fn is_downgradable(&self) -> bool
pub fn is_downgradable(&self) -> bool
Returns true when the inline text carries no information that
RunContent::Text(String) could not also represent — i.e. every
segment is Plain or a default tab. Projection can downgrade
such InlineText back to Text(String) to keep the audit
baseline simple.
Trait Implementations§
Source§impl Clone for InlineText
impl Clone for InlineText
Source§fn clone(&self) -> InlineText
fn clone(&self) -> InlineText
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InlineText
impl Debug for InlineText
Source§impl Default for InlineText
impl Default for InlineText
Source§fn default() -> InlineText
fn default() -> InlineText
Source§impl<'de> Deserialize<'de> for InlineText
impl<'de> Deserialize<'de> for InlineText
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>,
Source§impl JsonSchema for InlineText
impl JsonSchema for InlineText
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 moreSource§impl PartialEq for InlineText
impl PartialEq for InlineText
Source§fn eq(&self, other: &InlineText) -> bool
fn eq(&self, other: &InlineText) -> bool
self and other values to be equal, and is used by ==.