Fix doc links

This commit is contained in:
Simon Ask Ulsnes 2024-02-04 11:09:18 +01:00
parent 1df2e6f998
commit 15b3e412f5
4 changed files with 21 additions and 28 deletions

View file

@ -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);
@ -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() {

View file

@ -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 {
@ -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 {
@ -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);

View file

@ -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.
@ -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 {

View file

@ -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 {