Fix doc comments.
This commit is contained in:
parent
9089c117de
commit
823a137a76
|
@ -3,7 +3,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "opml"
|
name = "opml"
|
||||||
authors = ["Holllo <helllo@holllo.cc>"]
|
authors = ["Holllo <helllo@holllo.cc>"]
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
license = "MIT/Apache-2.0"
|
license = "MIT/Apache-2.0"
|
||||||
description = "An OPML 2.0 parser for Rust."
|
description = "An OPML 2.0 parser for Rust."
|
||||||
repository = "https://gitlab.com/holllo/opml-rs"
|
repository = "https://gitlab.com/holllo/opml-rs"
|
||||||
|
|
|
@ -3,19 +3,19 @@
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use strong_xml::{XmlError, XmlRead, XmlWrite};
|
use strong_xml::{XmlError, XmlRead, XmlWrite};
|
||||||
|
|
||||||
/// <opml> is an XML element, with a single required attribute, version; a <head> element and a <body> element, both of which are required.
|
/// `<opml>` is an XML element, with a single required attribute, version; a `<head>` element and a `<body>` element, both of which are required.
|
||||||
#[derive(XmlWrite, XmlRead, PartialEq, Debug)]
|
#[derive(XmlWrite, XmlRead, PartialEq, Debug)]
|
||||||
#[xml(tag = "opml")]
|
#[xml(tag = "opml")]
|
||||||
pub struct OPML {
|
pub struct OPML {
|
||||||
/// The version attribute is a version string, of the form, x.y, where x and y are both numeric strings.
|
/// The version attribute is a version string, of the form, x.y, where x and y are both numeric strings.
|
||||||
#[xml(attr = "version")]
|
#[xml(attr = "version")]
|
||||||
pub version: String,
|
pub version: String,
|
||||||
|
|
||||||
/// A <head> contains zero or more optional elements.
|
/// A `<head>` contains zero or more optional elements.
|
||||||
#[xml(child = "head")]
|
#[xml(child = "head")]
|
||||||
pub head: Head,
|
pub head: Head,
|
||||||
|
|
||||||
/// A <body> contains one or more <outline> elements.
|
/// A `<body>` contains one or more `<outline>` elements.
|
||||||
#[xml(child = "body")]
|
#[xml(child = "body")]
|
||||||
pub body: Body,
|
pub body: Body,
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ impl OPML {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// SPEC: A <body> contains one or more <outline> elements.
|
// SPEC: A `<body>` contains one or more `<outline>` elements.
|
||||||
if opml.body.outlines.is_empty() {
|
if opml.body.outlines.is_empty() {
|
||||||
return Err("OPML body has no outlines.".to_string());
|
return Err("OPML body has no outlines.".to_string());
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ impl OPML {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A <head> contains zero or more optional elements.
|
/// A `<head>` contains zero or more optional elements.
|
||||||
#[derive(XmlWrite, XmlRead, PartialEq, Debug)]
|
#[derive(XmlWrite, XmlRead, PartialEq, Debug)]
|
||||||
#[xml(tag = "head")]
|
#[xml(tag = "head")]
|
||||||
pub struct Head {
|
pub struct Head {
|
||||||
|
@ -109,7 +109,7 @@ pub struct Head {
|
||||||
pub window_right: Option<i32>,
|
pub window_right: Option<i32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A <body> contains one or more <outline> elements.
|
/// A `<body>` contains one or more `<outline>` elements.
|
||||||
#[derive(XmlWrite, XmlRead, PartialEq, Debug)]
|
#[derive(XmlWrite, XmlRead, PartialEq, Debug)]
|
||||||
#[xml(tag = "body")]
|
#[xml(tag = "body")]
|
||||||
pub struct Body {
|
pub struct Body {
|
||||||
|
@ -118,7 +118,7 @@ pub struct Body {
|
||||||
pub outlines: Vec<Outline>,
|
pub outlines: Vec<Outline>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An <outline> is an XML element containing at least one required attribute, text, and zero or more additional attributes. An <outline> may contain zero or more <outline> sub-elements. No attribute may be repeated within the same <outline> element.
|
/// An `<outline>` is an XML element containing at least one required attribute, text, and zero or more additional attributes. An `<outline>` may contain zero or more `<outline>` sub-elements. No attribute may be repeated within the same `<outline>` element.
|
||||||
#[derive(XmlWrite, XmlRead, PartialEq, Debug)]
|
#[derive(XmlWrite, XmlRead, PartialEq, Debug)]
|
||||||
#[xml(tag = "outline")]
|
#[xml(tag = "outline")]
|
||||||
pub struct Outline {
|
pub struct Outline {
|
||||||
|
@ -127,7 +127,7 @@ pub struct Outline {
|
||||||
#[xml(attr = "text")]
|
#[xml(attr = "text")]
|
||||||
pub text: String,
|
pub text: String,
|
||||||
|
|
||||||
/// A string that says how the other attributes of the <outline> are interpreted.
|
/// A string that says how the other attributes of the `<outline>` are interpreted.
|
||||||
#[xml(attr = "type")]
|
#[xml(attr = "type")]
|
||||||
pub r#type: Option<String>,
|
pub r#type: Option<String>,
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue