chore: impl Debug for all struct and enum
This commit is contained in:
parent
128825f148
commit
6b1e2a26be
17 changed files with 64 additions and 28 deletions
|
|
@ -1,11 +1,14 @@
|
|||
#[cfg_attr(test, derive(PartialEq, Debug))]
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
#[derive(Debug)]
|
||||
pub struct Cookie<'a> {
|
||||
value: &'a str,
|
||||
}
|
||||
|
||||
impl<'a> Cookie<'a> {
|
||||
pub fn parse(src: &'a str) -> Option<(Cookie<'a>, usize)> {
|
||||
starts_with!(src, '[');
|
||||
if cfg!(test) {
|
||||
starts_with!(src, '[');
|
||||
}
|
||||
|
||||
let num1 = until_while!(src, 1, |c| c == b'%' || c == b'/', |c: u8| c
|
||||
.is_ascii_digit());
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#[cfg_attr(test, derive(PartialEq, Debug))]
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
#[derive(Debug)]
|
||||
pub struct FnRef<'a> {
|
||||
label: Option<&'a str>,
|
||||
definition: Option<&'a str>,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#[cfg_attr(test, derive(PartialEq, Debug))]
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
#[derive(Debug)]
|
||||
pub struct Fragment<'a> {
|
||||
value: &'a str,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#[cfg_attr(test, derive(PartialEq, Debug))]
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
#[derive(Debug)]
|
||||
pub struct InlineCall<'a> {
|
||||
pub name: &'a str,
|
||||
pub args: &'a str,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#[cfg_attr(test, derive(PartialEq, Debug))]
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
#[derive(Debug)]
|
||||
pub struct InlineSrc<'a> {
|
||||
pub lang: &'a str,
|
||||
pub option: Option<&'a str>,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#[cfg_attr(test, derive(PartialEq, Debug))]
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
#[derive(Debug)]
|
||||
pub struct Link<'a> {
|
||||
pub path: &'a str,
|
||||
pub desc: Option<&'a str>,
|
||||
|
|
@ -6,7 +7,9 @@ pub struct Link<'a> {
|
|||
|
||||
impl<'a> Link<'a> {
|
||||
pub fn parse(src: &'a str) -> Option<(Link<'a>, usize)> {
|
||||
starts_with!(src, "[[");
|
||||
if cfg!(test) {
|
||||
starts_with!(src, "[[");
|
||||
}
|
||||
|
||||
let path = until_while!(src, 2, b']', |c| c != b']'
|
||||
&& c != b'<'
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use jetscii::Substring;
|
||||
|
||||
#[cfg_attr(test, derive(PartialEq, Debug))]
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
#[derive(Debug)]
|
||||
pub struct Macros<'a> {
|
||||
pub name: &'a str,
|
||||
pub args: Option<&'a str>,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
use jetscii::Substring;
|
||||
|
||||
#[cfg_attr(test, derive(PartialEq, Debug))]
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
#[derive(Debug)]
|
||||
pub struct Snippet<'a> {
|
||||
pub name: &'a str,
|
||||
pub value: &'a str,
|
||||
|
|
@ -8,7 +9,9 @@ pub struct Snippet<'a> {
|
|||
|
||||
impl<'a> Snippet<'a> {
|
||||
pub fn parse(src: &'a str) -> Option<(Snippet<'a>, usize)> {
|
||||
starts_with!(src, "@@");
|
||||
if cfg!(test) {
|
||||
starts_with!(src, "@@");
|
||||
}
|
||||
|
||||
let name = until_while!(src, 2, b':', |c: u8| c.is_ascii_alphanumeric() || c == b'-');
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,14 @@
|
|||
#[cfg_attr(test, derive(PartialEq, Debug))]
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
#[derive(Debug)]
|
||||
// TODO: text-markup, entities, latex-fragments, subscript and superscript
|
||||
pub struct RadioTarget<'a>(&'a str);
|
||||
|
||||
impl<'a> RadioTarget<'a> {
|
||||
pub fn parse(src: &'a str) -> Option<(RadioTarget<'a>, usize)> {
|
||||
starts_with!(src, "<<<");
|
||||
if cfg!(test) {
|
||||
starts_with!(src, "<<<");
|
||||
}
|
||||
|
||||
expect!(src, 3, |c| c != b' ');
|
||||
|
||||
let end = until_while!(src, 3, b'>', |c| c != b'<' && c != b'\n');
|
||||
|
|
@ -17,12 +21,16 @@ impl<'a> RadioTarget<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(test, derive(PartialEq, Debug))]
|
||||
#[cfg_attr(test, derive(PartialEq))]
|
||||
#[derive(Debug)]
|
||||
pub struct Target<'a>(&'a str);
|
||||
|
||||
impl<'a> Target<'a> {
|
||||
pub fn parse(src: &'a str) -> Option<(Target<'a>, usize)> {
|
||||
starts_with!(src, "<<");
|
||||
if cfg!(test) {
|
||||
starts_with!(src, "<<");
|
||||
}
|
||||
|
||||
expect!(src, 2, |c| c != b' ');
|
||||
|
||||
let end = until_while!(src, 2, b'>', |c| c != b'<' && c != b'\n');
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#[cfg_attr(test, derive(PartialEq))]
|
||||
#[derive(Debug)]
|
||||
pub struct Time<'a> {
|
||||
pub date: &'a str,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue