Add borrowed serde support
This commit is contained in:
parent
ce024a120e
commit
34d350da19
1 changed files with 13 additions and 13 deletions
26
src/lib.rs
26
src/lib.rs
|
@ -13,20 +13,20 @@ use serde::{Deserialize, Serialize};
|
||||||
pub use serde_suck::*;
|
pub use serde_suck::*;
|
||||||
|
|
||||||
pub struct JotdownBufferIter<'a, T: Iterator<Item = Event<'a>>> {
|
pub struct JotdownBufferIter<'a, T: Iterator<Item = Event<'a>>> {
|
||||||
djot: T,
|
pub djot: T,
|
||||||
indent: Vec<Indent>,
|
pub indent: Vec<Indent>,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct JotdownIntoBuffer<'a, 'b, T: Iterator<Item = Event<'a>>> {
|
struct JotdownIntoBuffer<'a, 'b, T: Iterator<Item = Event<'a>>> {
|
||||||
djot: &'b mut T,
|
pub djot: &'b mut T,
|
||||||
attrs: Attrs<'static>,
|
pub attrs: Attrs<'static>,
|
||||||
metrics: Metrics,
|
pub metrics: Metrics,
|
||||||
indent: &'b mut Vec<Indent>,
|
pub indent: &'b mut Vec<Indent>,
|
||||||
image_url: Option<Cow<'a, str>>,
|
pub image_url: Option<Cow<'a, str>>,
|
||||||
link_start: usize,
|
pub link_start: usize,
|
||||||
urls: Vec<(std::ops::Range<usize>, Cow<'a, str>)>,
|
pub urls: Vec<(std::ops::Range<usize>, Cow<'a, str>)>,
|
||||||
location: usize,
|
pub location: usize,
|
||||||
added: bool,
|
pub added: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, Clone, Copy)]
|
#[derive(Default, Clone, Copy)]
|
||||||
|
@ -140,10 +140,10 @@ impl<'a, 'b, T: Iterator<Item = Event<'a>>> Iterator for JotdownIntoBuffer<'a, '
|
||||||
|
|
||||||
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
||||||
pub struct RichText<'a>(
|
pub struct RichText<'a>(
|
||||||
Cow<'a, str>,
|
pub Cow<'a, str>,
|
||||||
#[cfg_attr(feature = "serde", serde(with = "AttrsSerde"))]
|
#[cfg_attr(feature = "serde", serde(with = "AttrsSerde"))]
|
||||||
#[cfg_attr(feature = "serde", serde(borrow))]
|
#[cfg_attr(feature = "serde", serde(borrow))]
|
||||||
Attrs<'a>,
|
pub Attrs<'a>,
|
||||||
);
|
);
|
||||||
|
|
||||||
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
||||||
|
|
Loading…
Reference in a new issue