diff options
author | Jovansonlee Cesar <ivanceras@gmail.com> | 2020-11-28 15:21:09 +0800 |
---|---|---|
committer | Jovansonlee Cesar <ivanceras@gmail.com> | 2020-11-28 15:21:09 +0800 |
commit | 5f4e679ef65755871e2926b1668acf35d15778d7 (patch) | |
tree | c1627b13127686cce0abe598a1cc8451f02753c2 | |
parent | 679e5a24f4abb3bf3c5d8a8da3ab1233f34acdb3 (diff) |
Expose some functions and structs
-rw-r--r-- | svgbob/Cargo.toml | 2 | ||||
-rw-r--r-- | svgbob/src/buffer/cell_buffer.rs | 2 | ||||
-rw-r--r-- | svgbob/src/buffer/fragment_buffer.rs | 4 | ||||
-rw-r--r-- | svgbob/src/buffer/fragment_buffer/fragment/arc.rs | 4 | ||||
-rw-r--r-- | svgbob/src/buffer/fragment_buffer/fragment/circle.rs | 2 | ||||
-rw-r--r-- | svgbob/src/buffer/fragment_buffer/fragment/line.rs | 6 | ||||
-rw-r--r-- | svgbob/src/buffer/fragment_buffer/fragment/text.rs | 4 | ||||
-rw-r--r-- | svgbob/src/buffer/property_buffer/property.rs | 7 | ||||
-rw-r--r-- | svgbob/src/buffer/string_buffer.rs | 2 | ||||
-rw-r--r-- | svgbob/src/lib.rs | 2 | ||||
-rw-r--r-- | svgbob/src/map.rs | 5 |
11 files changed, 20 insertions, 20 deletions
diff --git a/svgbob/Cargo.toml b/svgbob/Cargo.toml index 30274b2..694a99d 100644 --- a/svgbob/Cargo.toml +++ b/svgbob/Cargo.toml @@ -13,7 +13,7 @@ license = "Apache-2.0" nalgebra = "0.18.0" ncollide2d = "0.19.1" lazy_static = "1.3.0" -sauron = { version = "0.32" } +sauron = { version = "0.33" } unicode-width = "0.1.5" itertools = "0.8.0" pom = { version = "3.1.0" } diff --git a/svgbob/src/buffer/cell_buffer.rs b/svgbob/src/buffer/cell_buffer.rs index fa3a634..d2e4f70 100644 --- a/svgbob/src/buffer/cell_buffer.rs +++ b/svgbob/src/buffer/cell_buffer.rs @@ -325,7 +325,7 @@ impl CellBuffer { /// convert the fragments into svg nodes using the supplied settings, with size for the /// dimension - pub(crate) fn fragments_to_node<MSG>( + pub fn fragments_to_node<MSG>( fragments: Vec<Fragment>, legend_css: String, settings: &Settings, diff --git a/svgbob/src/buffer/fragment_buffer.rs b/svgbob/src/buffer/fragment_buffer.rs index 5f5c6cd..0051b86 100644 --- a/svgbob/src/buffer/fragment_buffer.rs +++ b/svgbob/src/buffer/fragment_buffer.rs @@ -99,7 +99,7 @@ impl FragmentBuffer { } } - pub(crate) fn get_size(&self, settings: &Settings) -> (f32, f32) { + pub fn get_size(&self, settings: &Settings) -> (f32, f32) { let (_top_left, bottom_right) = self.bounds().unwrap_or((Cell::new(0, 0), Cell::new(0, 0))); let w = settings.scale * (bottom_right.x + 2) as f32 * Cell::width(); @@ -121,7 +121,7 @@ impl FragmentBuffer { self.sort_fragments_in_cell(cell); } - pub(crate) fn merge_fragments(&self) -> Vec<Fragment> { + pub fn merge_fragments(&self) -> Vec<Fragment> { let fragments = self.first_pass_merge(); Self::merge_recursive(fragments) } diff --git a/svgbob/src/buffer/fragment_buffer/fragment/arc.rs b/svgbob/src/buffer/fragment_buffer/fragment/arc.rs index d59cd8c..756a8d4 100644 --- a/svgbob/src/buffer/fragment_buffer/fragment/arc.rs +++ b/svgbob/src/buffer/fragment_buffer/fragment/arc.rs @@ -81,7 +81,7 @@ impl Arc { } } - pub(in crate) fn scale(&self, scale: f32) -> Self { + pub fn scale(&self, scale: f32) -> Self { Arc { start: self.start.scale(scale), end: self.end.scale(scale), @@ -103,7 +103,7 @@ impl Arc { } /// calculate the center point this arc - fn center(&self) -> Point { + pub fn center(&self) -> Point { let start = self.start; let end = self.end; let q = start.distance(&end); diff --git a/svgbob/src/buffer/fragment_buffer/fragment/circle.rs b/svgbob/src/buffer/fragment_buffer/fragment/circle.rs index 396ef69..e3f9717 100644 --- a/svgbob/src/buffer/fragment_buffer/fragment/circle.rs +++ b/svgbob/src/buffer/fragment_buffer/fragment/circle.rs @@ -41,7 +41,7 @@ impl Circle { } } - pub(in crate) fn scale(&self, scale: f32) -> Self { + pub fn scale(&self, scale: f32) -> Self { Circle { center: self.center.scale(scale), radius: self.radius * scale, diff --git a/svgbob/src/buffer/fragment_buffer/fragment/line.rs b/svgbob/src/buffer/fragment_buffer/fragment/line.rs index 1be9425..743ab97 100644 --- a/svgbob/src/buffer/fragment_buffer/fragment/line.rs +++ b/svgbob/src/buffer/fragment_buffer/fragment/line.rs @@ -23,7 +23,7 @@ pub struct Line { impl Line { /// creates a new line and reorder the points swapping the end points if necessary /// such that the start is the most top-left and end point is the most bottom-right - pub(in crate) fn new(start: Point, end: Point, is_broken: bool) -> Self { + pub fn new(start: Point, end: Point, is_broken: bool) -> Self { let mut line = Line { start, end, @@ -451,7 +451,7 @@ impl Line { } } - pub(in crate) fn scale(&self, scale: f32) -> Self { + pub fn scale(&self, scale: f32) -> Self { Line { start: self.start.scale(scale), end: self.end.scale(scale), @@ -463,7 +463,7 @@ impl Line { self.is_broken } - pub(crate) fn localize(&self, cell: Cell) -> Self { + pub fn localize(&self, cell: Cell) -> Self { Line { start: cell.localize_point(self.start), end: cell.localize_point(self.end), diff --git a/svgbob/src/buffer/fragment_buffer/fragment/text.rs b/svgbob/src/buffer/fragment_buffer/fragment/text.rs index 5462ac8..061fdc9 100644 --- a/svgbob/src/buffer/fragment_buffer/fragment/text.rs +++ b/svgbob/src/buffer/fragment_buffer/fragment/text.rs @@ -14,8 +14,8 @@ use std::{borrow::Cow, cmp::Ordering, fmt}; /// track of the scale. #[derive(Debug, Clone, Eq, PartialEq, Ord, PartialOrd)] pub struct CellText { - pub(crate) start: Cell, - pub(crate) content: String, + pub start: Cell, + pub content: String, } impl CellText { diff --git a/svgbob/src/buffer/property_buffer/property.rs b/svgbob/src/buffer/property_buffer/property.rs index f2d9d9a..20d5a35 100644 --- a/svgbob/src/buffer/property_buffer/property.rs +++ b/svgbob/src/buffer/property_buffer/property.rs @@ -132,10 +132,7 @@ impl Property { } /// derive a strong property with a strong signal - pub(in crate) fn with_strong_fragments( - ch: char, - fragments: Vec<Fragment>, - ) -> Self { + pub fn with_strong_fragments(ch: char, fragments: Vec<Fragment>) -> Self { Property { ch, signature: vec![(Signal::Strong, fragments)], @@ -175,7 +172,7 @@ impl Property { self.ch.is_alphabetic() && self.ch != '_' // since space is used when a property is derived from strong } - pub(in crate) fn match_signature(&self, fragments: &Vec<Fragment>) -> bool { + pub fn match_signature(&self, fragments: &Vec<Fragment>) -> bool { let signature_fragments = self.signature_fragments_with_signal(Strong); signature_fragments == *fragments } diff --git a/svgbob/src/buffer/string_buffer.rs b/svgbob/src/buffer/string_buffer.rs index d4ee1fa..159e683 100644 --- a/svgbob/src/buffer/string_buffer.rs +++ b/svgbob/src/buffer/string_buffer.rs @@ -23,7 +23,7 @@ impl DerefMut for StringBuffer { } impl StringBuffer { - pub(in crate) fn new() -> Self { + pub fn new() -> Self { StringBuffer(vec![]) } diff --git a/svgbob/src/lib.rs b/svgbob/src/lib.rs index 1252e67..3fe7c75 100644 --- a/svgbob/src/lib.rs +++ b/svgbob/src/lib.rs @@ -3,7 +3,7 @@ #![deny(clippy::all)] pub mod buffer; -mod map; +pub mod map; mod point; pub mod util; diff --git a/svgbob/src/map.rs b/svgbob/src/map.rs index 267420d..7cbea3d 100644 --- a/svgbob/src/map.rs +++ b/svgbob/src/map.rs @@ -1,5 +1,8 @@ pub use ascii_map::ASCII_PROPERTIES; -pub use unicode_map::{UNICODE_FRAGMENTS, UNICODE_PROPERTIES}; +pub use circle_map::CIRCLES_SPAN; +pub use unicode_map::{ + FRAGMENTS_UNICODE, UNICODE_FRAGMENTS, UNICODE_PROPERTIES, +}; pub(in crate) mod ascii_map; pub(in crate) mod circle_map; |