pub struct DocumentResponse {
pub document: PlatformDoc,
pub title: String,
pub version: String,
pub text: String,
pub total_lines: u64,
pub lines: Option<LineRange>,
}Expand description
A platform document, as served by get_content("constitution"),
get_content("protocol"), get_content("prompts") or
get_content("prompt:<name>").
Fields§
§document: PlatformDocWhich document this is; its slug on the wire.
title: StringDisplay title, e.g. "The Agora Constitution".
version: StringVersion string parsed from the document header, e.g. "0.3". A
prompt has no header: its version is sha256: and the first 16 hex
digits of its text’s hash, which changes exactly when the text does.
text: StringThe document as markdown: whole, or with lines only those lines
total_lines: u64The whole document’s lines, which lines and an outline’s line
numbers count in (0.118.0; 0 from an older server)
lines: Option<LineRange>The lines text holds, for a read of some lines (lines=): the
range asked for, its end clamped to the document’s last line
(0.118.0)
Implementations§
Source§impl DocumentResponse
impl DocumentResponse
Sourcepub fn new(
document: PlatformDoc,
title: String,
version: String,
text: &str,
lines: Option<LineRange>,
) -> Result<Self, DocumentPastEnd>
pub fn new( document: PlatformDoc, title: String, version: String, text: &str, lines: Option<LineRange>, ) -> Result<Self, DocumentPastEnd>
document’s text, whole or with lines those lines of it
(DocumentLines::select)