Skip to content

Commit

Permalink
Fix doc links
Browse files Browse the repository at this point in the history
  • Loading branch information
simonask committed Feb 4, 2024
1 parent 1df2e6f commit 15b3e41
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 28 deletions.
17 changes: 7 additions & 10 deletions src/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,14 +255,12 @@ impl Document {
/// Call this function subsequently to produce a sequence of documents
/// constituting the input stream.
///
/// If the produced document has no root node, it means that the document end
/// has been reached.
/// If the produced document has no root node, it means that the document
/// end has been reached.
///
/// An application must not alternate the calls of
/// [`yaml_parser_load()`](crate::yaml_parser_load) with the calls of
/// [`yaml_parser_scan()`](crate::yaml_parser_scan) or
/// [`yaml_parser_parse()`](crate::yaml_parser_parse). Doing this will break the
/// parser.
/// An application must not alternate the calls of [`Document::load()`] with
/// the calls of [`yaml_parser_scan()`](crate::yaml_parser_scan) or
/// [`Parser::parse()`]. Doing this will break the parser.
pub fn load(parser: &mut Parser) -> Result<Document, ComposerError> {
let mut document = Document::new(None, &[], false, false);
document.nodes.reserve(16);
Expand Down Expand Up @@ -609,9 +607,8 @@ impl Document {

/// Emit a YAML document.
///
/// The document object may be generated using the
/// [`yaml_parser_load()`](crate::yaml_parser_load) function or the
/// [`Document::new()`] function.
/// The document object may be generated using the [`Document::load()`]
/// function or the [`Document::new()`] function.
pub fn dump(mut self, emitter: &mut Emitter) -> Result<(), EmitterError> {
if !emitter.opened {
if let Err(err) = emitter.open() {
Expand Down
8 changes: 4 additions & 4 deletions src/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ impl<'w> Emitter<'w> {
/// Start a YAML stream.
///
/// This function should be used before
/// [`yaml_emitter_dump()`](crate::yaml_emitter_dump) is called.
/// [`Document::dump()`](crate::Document::dump) is called.
pub fn open(&mut self) -> Result<(), EmitterError> {
assert!(!self.opened);
let event = Event {
Expand All @@ -298,7 +298,7 @@ impl<'w> Emitter<'w> {
/// Finish a YAML stream.
///
/// This function should be used after
/// [`yaml_emitter_dump()`](crate::yaml_emitter_dump) is called.
/// [`Document::dump()`](crate::Document::dump) is called.
pub fn close(&mut self) -> Result<(), EmitterError> {
assert!(self.opened);
if self.closed {
Expand Down Expand Up @@ -368,8 +368,8 @@ impl<'w> Emitter<'w> {
/// Emit an event.
///
/// The event object may be generated using the
/// [`yaml_parser_parse()`](crate::yaml_parser_parse) function. The emitter
/// takes the responsibility for the event object and destroys its content after
/// [`Parser::parse()`](crate::Parser::parse) function. The emitter takes
/// the responsibility for the event object and destroys its content after
/// it is emitted. The event object is destroyed even if the function fails.
pub fn emit(&mut self, event: Event) -> Result<(), EmitterError> {
self.events.push_back(event);
Expand Down
19 changes: 8 additions & 11 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ use crate::{
};

/// The parser structure.
///
/// All members are internal. Manage the structure using the `yaml_parser_`
/// family of functions.
#[non_exhaustive]
pub struct Parser<'r> {
/// Read handler.
Expand Down Expand Up @@ -250,15 +247,15 @@ impl<'r> Parser<'r> {

/// Parse the input stream and produce the next parsing event.
///
/// Call the function subsequently to produce a sequence of events corresponding
/// to the input stream. The initial event has the type
/// [`EventData::StreamStart`](crate::EventData::StreamStart) while the ending
/// event has the type [`EventData::StreamEnd`](crate::EventData::StreamEnd).
/// Call the function subsequently to produce a sequence of events
/// corresponding to the input stream. The initial event has the type
/// [`EventData::StreamStart`](crate::EventData::StreamStart) while the
/// ending event has the type
/// [`EventData::StreamEnd`](crate::EventData::StreamEnd).
///
/// An application must not alternate the calls of
/// [`yaml_parser_parse()`](crate::yaml_parser_parse) with the calls of
/// [`yaml_parser_scan()`](crate::yaml_parser_scan) or
/// [`yaml_parser_load()`](crate::yaml_parser_load). Doing this will break the
/// An application must not alternate the calls of [`Parser::parse()`] with
/// the calls of [`yaml_parser_scan()`](crate::yaml_parser_scan) or
/// [`Document::load()`](crate::Document::load). Doing this will break the
/// parser.
pub fn parse(&mut self) -> Result<Event, ParserError> {
if self.stream_end_produced || self.state == ParserState::End {
Expand Down
5 changes: 2 additions & 3 deletions src/scanner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,8 @@ fn READ_LINE_STRING(parser: &mut Parser, string: &mut String) {
///
/// An application must not alternate the calls of
/// [`yaml_parser_scan()`](crate::yaml_parser_scan) with the calls of
/// [`yaml_parser_parse()`](crate::yaml_parser_parse) or
/// [`yaml_parser_load()`](crate::yaml_parser_load). Doing this will break the
/// parser.
/// [`Parser::parse()`] or [`Document::load()`](crate::Document::load). Doing
/// this will break the parser.
pub fn yaml_parser_scan(parser: &mut Parser) -> Result<Token, ScannerError> {
if parser.stream_end_produced {
return Ok(Token {
Expand Down

0 comments on commit 15b3e41

Please sign in to comment.