[librsvg: 3/5] librsvg_crate: rename get_ from getters
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 3/5] librsvg_crate: rename get_ from getters
- Date: Mon, 25 Feb 2019 19:54:38 +0000 (UTC)
commit 313dc2566ce1724378c14482042703d896285b37
Author: Paolo Borelli <pborelli gnome org>
Date: Sun Feb 24 16:15:16 2019 +0100
librsvg_crate: rename get_ from getters
https://rust-lang-nursery.github.io/api-guidelines/naming.html#c-getter
librsvg_crate/examples/render.rs | 2 +-
librsvg_crate/src/lib.rs | 6 +++---
librsvg_crate/tests/intrinsic-dimensions.rs | 16 ++++++++--------
3 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/librsvg_crate/examples/render.rs b/librsvg_crate/examples/render.rs
index ee88cb0d..7265ec32 100644
--- a/librsvg_crate/examples/render.rs
+++ b/librsvg_crate/examples/render.rs
@@ -21,7 +21,7 @@ fn main() {
let handle = librsvg::Loader::new().read_path(input).unwrap();
let renderer = librsvg::CairoRenderer::new(&handle);
- let (w, h) = renderer.get_dimensions().unwrap();
+ let (w, h) = renderer.dimensions().unwrap();
let surface = cairo::ImageSurface::create(cairo::Format::ARgb32, w, h).unwrap();
let cr = cairo::Context::new(&surface);
diff --git a/librsvg_crate/src/lib.rs b/librsvg_crate/src/lib.rs
index e4f6e605..204b5d80 100644
--- a/librsvg_crate/src/lib.rs
+++ b/librsvg_crate/src/lib.rs
@@ -355,14 +355,14 @@ impl<'a> CairoRenderer<'a> {
}
}
- pub fn get_dimensions(&self) -> Result<(i32, i32), RenderingError> {
+ pub fn dimensions(&self) -> Result<(i32, i32), RenderingError> {
self.handle
.0
.get_dimensions()
.map(|dimensions| (dimensions.width, dimensions.height))
}
- pub fn get_intrinsic_dimensions(&self) -> IntrinsicDimensions {
+ pub fn intrinsic_dimensions(&self) -> IntrinsicDimensions {
let d = self.handle.0.get_intrinsic_dimensions();
IntrinsicDimensions {
@@ -400,7 +400,7 @@ impl<'a> CairoRenderer<'a> {
/// the child elements.
///
/// FIXME: example
- pub fn get_geometry_for_element(
+ pub fn geometry_for_element(
&self,
id: Option<&str>,
) -> Result<(cairo::Rectangle, cairo::Rectangle), RenderingError> {
diff --git a/librsvg_crate/tests/intrinsic-dimensions.rs b/librsvg_crate/tests/intrinsic-dimensions.rs
index f112de1f..b0254eb5 100644
--- a/librsvg_crate/tests/intrinsic-dimensions.rs
+++ b/librsvg_crate/tests/intrinsic-dimensions.rs
@@ -36,7 +36,7 @@ fn no_intrinsic_dimensions() {
);
assert_eq!(
- CairoRenderer::new(&svg).get_intrinsic_dimensions(),
+ CairoRenderer::new(&svg).intrinsic_dimensions(),
IntrinsicDimensions {
width: None,
height: None,
@@ -54,7 +54,7 @@ fn has_intrinsic_dimensions() {
);
assert_eq!(
- CairoRenderer::new(&svg).get_intrinsic_dimensions(),
+ CairoRenderer::new(&svg).intrinsic_dimensions(),
IntrinsicDimensions {
width: Some(Length::new(10.0, LengthUnit::Cm)),
height: Some(Length::new(20.0, LengthUnit::Px)),
@@ -79,7 +79,7 @@ fn root_geometry_with_percent_viewport() {
);
let renderer = CairoRenderer::new(&svg);
- let (ink_r, logical_r) = renderer.get_geometry_for_element(None).unwrap();
+ let (ink_r, logical_r) = renderer.geometry_for_element(None).unwrap();
let rect = cairo::Rectangle {
x: 10.0,
@@ -102,7 +102,7 @@ fn element_geometry_with_percent_viewport() {
);
let renderer = CairoRenderer::new(&svg);
- let (ink_r, logical_r) = renderer.get_geometry_for_element(Some("#foo")).unwrap();
+ let (ink_r, logical_r) = renderer.geometry_for_element(Some("#foo")).unwrap();
let rect = cairo::Rectangle {
x: 10.0,
@@ -123,7 +123,7 @@ fn element_geometry_for_nonexistent_element() {
);
let renderer = CairoRenderer::new(&svg);
- match renderer.get_geometry_for_element(Some("#foo")) {
+ match renderer.geometry_for_element(Some("#foo")) {
Err(RenderingError::InvalidId(DefsLookupErrorKind::NotFound)) => (),
_ => panic!(),
}
@@ -138,17 +138,17 @@ fn element_geometry_for_invalid_id() {
);
let renderer = CairoRenderer::new(&svg);
- match renderer.get_geometry_for_element(Some("foo")) {
+ match renderer.geometry_for_element(Some("foo")) {
Err(RenderingError::InvalidId(DefsLookupErrorKind::CannotLookupExternalReferences)) => (),
_ => panic!(),
}
- match renderer.get_geometry_for_element(Some("foo.svg#foo")) {
+ match renderer.geometry_for_element(Some("foo.svg#foo")) {
Err(RenderingError::InvalidId(DefsLookupErrorKind::CannotLookupExternalReferences)) => (),
_ => panic!(),
}
- match renderer.get_geometry_for_element(Some("")) {
+ match renderer.geometry_for_element(Some("")) {
Err(RenderingError::InvalidId(DefsLookupErrorKind::HrefError(HrefError::ParseError))) => (),
_ => panic!(),
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]