pub struct SpineItem {
pub idref: String,
pub id: Option<String>,
pub properties: Option<String>,
pub linear: bool,
}Expand description
Represents an item in the EPUB spine, defining the reading order of the publication
The SpineItem structure represents a single item in the EPUB spine, which defines
the linear reading order of the publication’s content documents. Each spine item
references a resource declared in the manifest and indicates whether it should be
included in the linear reading sequence.
The spine is a crucial component of an EPUB publication as it determines the recommended reading order of content documents. Items can be marked as linear (part of the main reading flow) or non-linear (supplementary content that may be accessed out of sequence).
§Builder Methods
When the builder feature is enabled, this struct provides convenient builder methods:
use lib_epub::types::SpineItem;
let spine_item = SpineItem::new("content-1")
.with_id("spine-1")
.append_property("page-spread-right")
.set_linear(false)
.build();Fields§
§idref: StringThe ID reference to a manifest item
This field contains the ID of the manifest item that this spine item references. It establishes the connection between the reading order (spine) and the actual content resources (manifest). The referenced ID must exist in the manifest.
id: Option<String>Optional identifier for this spine item
properties: Option<String>Optional properties associated with this spine item
This field contains a space-separated list of properties that apply to this spine item. These properties can indicate special handling requirements, layout preferences, or other characteristics.
linear: boolIndicates whether this item is part of the linear reading order
When true, this spine item is part of the main linear reading sequence.
When false, this item represents supplementary content that may be accessed
out of the normal reading order (e.g., through hyperlinks).
Non-linear items are typically used for content like footnotes, endnotes, appendices, or other supplementary materials that readers might access on-demand rather than sequentially.
Implementations§
Source§impl SpineItem
impl SpineItem
Sourcepub fn new(idref: &str) -> Self
pub fn new(idref: &str) -> Self
Creates a new spine item referencing a manifest item
Requires the builder feature.
By default, spine items are linear.
§Parameters
idref- The ID of the manifest item this spine item references
Sourcepub fn with_id(&mut self, id: &str) -> &mut Self
pub fn with_id(&mut self, id: &str) -> &mut Self
Sets the ID of the spine item
Requires the builder feature.
§Parameters
id- The ID to assign to this spine item
Sourcepub fn append_property(&mut self, property: &str) -> &mut Self
pub fn append_property(&mut self, property: &str) -> &mut Self
Appends a property to the spine item
Requires the builder feature.
§Parameters
property- The property to add
Sourcepub fn set_linear(&mut self, linear: bool) -> &mut Self
pub fn set_linear(&mut self, linear: bool) -> &mut Self
Sets whether this spine item is part of the linear reading order
Requires the builder feature.
§Parameters
linear-trueif the item is part of the linear reading order,falseotherwise