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 struct JotdownBufferIter<'a, T: Iterator<Item = Event<'a>>> {
|
||||
djot: T,
|
||||
indent: Vec<Indent>,
|
||||
pub djot: T,
|
||||
pub indent: Vec<Indent>,
|
||||
}
|
||||
|
||||
struct JotdownIntoBuffer<'a, 'b, T: Iterator<Item = Event<'a>>> {
|
||||
djot: &'b mut T,
|
||||
attrs: Attrs<'static>,
|
||||
metrics: Metrics,
|
||||
indent: &'b mut Vec<Indent>,
|
||||
image_url: Option<Cow<'a, str>>,
|
||||
link_start: usize,
|
||||
urls: Vec<(std::ops::Range<usize>, Cow<'a, str>)>,
|
||||
location: usize,
|
||||
added: bool,
|
||||
pub djot: &'b mut T,
|
||||
pub attrs: Attrs<'static>,
|
||||
pub metrics: Metrics,
|
||||
pub indent: &'b mut Vec<Indent>,
|
||||
pub image_url: Option<Cow<'a, str>>,
|
||||
pub link_start: usize,
|
||||
pub urls: Vec<(std::ops::Range<usize>, Cow<'a, str>)>,
|
||||
pub location: usize,
|
||||
pub added: bool,
|
||||
}
|
||||
|
||||
#[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))]
|
||||
pub struct RichText<'a>(
|
||||
Cow<'a, str>,
|
||||
pub Cow<'a, str>,
|
||||
#[cfg_attr(feature = "serde", serde(with = "AttrsSerde"))]
|
||||
#[cfg_attr(feature = "serde", serde(borrow))]
|
||||
Attrs<'a>,
|
||||
pub Attrs<'a>,
|
||||
);
|
||||
|
||||
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
|
||||
|
|
Loading…
Reference in a new issue