pub struct Caption {
pub side: CaptionSide,
pub width: Option<HwpUnit>,
pub gap: HwpUnit,
pub paragraphs: Vec<Paragraph>,
}Expand description
Caption attached to a shape object (table, image, textbox, etc.).
Contains position, gap distance, optional explicit width, and the caption’s paragraph content. Empty paragraphs are valid (한글 allows it).
§Default
Default caption: side = Bottom, width = None, gap = 850 HWPUNIT (~3mm), paragraphs = empty.
§Examples
use hwpforge_core::caption::{Caption, CaptionSide};
use hwpforge_foundation::HwpUnit;
let cap = Caption::default();
assert_eq!(cap.side, CaptionSide::Bottom);
assert_eq!(cap.gap.as_i32(), 850);
assert!(cap.width.is_none());
assert!(cap.paragraphs.is_empty());Fields§
§side: CaptionSidePosition of the caption relative to the object.
width: Option<HwpUnit>Caption width in HwpUnit. None = auto (same as object width).
gap: HwpUnitGap between caption and object. Default: HwpUnit(850) (~3mm).
paragraphs: Vec<Paragraph>Caption content paragraphs.
Implementations§
Source§impl Caption
impl Caption
Sourcepub fn new(paragraphs: Vec<Paragraph>, side: CaptionSide) -> Self
pub fn new(paragraphs: Vec<Paragraph>, side: CaptionSide) -> Self
Creates a caption with the given paragraphs and side placement.
Uses default gap (850 HWPUNIT ≈ 3mm) and auto width (None).
§Examples
use hwpforge_core::caption::{Caption, CaptionSide};
use hwpforge_core::paragraph::Paragraph;
use hwpforge_foundation::ParaShapeIndex;
let cap = Caption::new(
vec![Paragraph::new(ParaShapeIndex::new(0))],
CaptionSide::Bottom,
);
assert_eq!(cap.side, CaptionSide::Bottom);
assert_eq!(cap.gap.as_i32(), 850);
assert!(cap.width.is_none());
assert_eq!(cap.paragraphs.len(), 1);Trait Implementations§
Source§impl<'de> Deserialize<'de> for Caption
impl<'de> Deserialize<'de> for Caption
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonSchema for Caption
impl JsonSchema for Caption
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreimpl StructuralPartialEq for Caption
Auto Trait Implementations§
impl Freeze for Caption
impl RefUnwindSafe for Caption
impl Send for Caption
impl Sync for Caption
impl Unpin for Caption
impl UnwindSafe for Caption
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
Mutably borrows from an owned value. Read more