Skip to content

Commit 55c21ab

Browse files
andrew000waywardmonkeys
authored andcommitted
Make Serializer and some of his methods public
1 parent 83e9a45 commit 55c21ab

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

fluent-syntax/src/serializer.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,22 @@ pub fn serialize_with_options<'s, S: Slice<'s>>(
6464
}
6565

6666
#[derive(Debug)]
67-
struct Serializer {
67+
pub struct Serializer {
6868
writer: TextWriter,
6969
options: Options,
7070
state: State,
7171
}
7272

7373
impl Serializer {
74-
fn new(options: Options) -> Self {
74+
pub fn new(options: Options) -> Self {
7575
Serializer {
7676
writer: TextWriter::default(),
7777
options,
7878
state: State::default(),
7979
}
8080
}
8181

82-
fn serialize_resource<'s, S: Slice<'s>>(&mut self, res: &Resource<S>) {
82+
pub fn serialize_resource<'s, S: Slice<'s>>(&mut self, res: &Resource<S>) {
8383
for entry in &res.body {
8484
match entry {
8585
Entry::Message(msg) => self.serialize_message(msg),
@@ -98,15 +98,15 @@ impl Serializer {
9898
}
9999
}
100100

101-
fn into_serialized_text(self) -> String {
101+
pub fn into_serialized_text(self) -> String {
102102
self.writer.buffer
103103
}
104104

105-
fn serialize_junk(&mut self, junk: &str) {
105+
pub fn serialize_junk(&mut self, junk: &str) {
106106
self.writer.write_literal(junk);
107107
}
108108

109-
fn serialize_free_comment<'s, S: Slice<'s>>(&mut self, comment: &Comment<S>, prefix: &str) {
109+
pub fn serialize_free_comment<'s, S: Slice<'s>>(&mut self, comment: &Comment<S>, prefix: &str) {
110110
if self.state.wrote_non_junk_entry {
111111
self.writer.newline();
112112
}
@@ -127,7 +127,7 @@ impl Serializer {
127127
}
128128
}
129129

130-
fn serialize_message<'s, S: Slice<'s>>(&mut self, msg: &Message<S>) {
130+
pub fn serialize_message<'s, S: Slice<'s>>(&mut self, msg: &Message<S>) {
131131
if let Some(comment) = msg.comment.as_ref() {
132132
self.serialize_comment(comment, "#");
133133
}
@@ -144,7 +144,7 @@ impl Serializer {
144144
self.writer.newline();
145145
}
146146

147-
fn serialize_term<'s, S: Slice<'s>>(&mut self, term: &Term<S>) {
147+
pub fn serialize_term<'s, S: Slice<'s>>(&mut self, term: &Term<S>) {
148148
if let Some(comment) = term.comment.as_ref() {
149149
self.serialize_comment(comment, "#");
150150
}

0 commit comments

Comments
 (0)