Skip to content

Commit

Permalink
Removed traces of TryFrom to make printpdf compile on stable
Browse files Browse the repository at this point in the history
  • Loading branch information
fschutt committed Nov 2, 2017
1 parent 15fabab commit 0f74f7b
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 17 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,11 @@
Scaling of images is implicitly done to fit one pixel = one dot at 300 dpi.

```
#![feature(try_from)]
extern crate printpdf;
extern crate image; /* currently: version 0.14.0 */
use printpdf::*;
use std::fs::File;
use std::convert::TryFrom;
use std::convert::From;
fn main() {
Expand Down
2 changes: 0 additions & 2 deletions examples/images.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#![feature(try_from)]
extern crate printpdf;
extern crate image;

use printpdf::*;
use std::io::Cursor;
use std::convert::TryFrom;
use image::bmp::BMPDecoder;
use std::fs::File;

Expand Down
4 changes: 0 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,11 @@
//! Scaling of images is implicitly done to fit one pixel = one dot at 300 dpi.
//!
//! ```
//! #![feature(try_from)]
//! extern crate printpdf;
//! extern crate image; /* currently: version 0.14.0 */
//!
//! use printpdf::*;
//! use std::fs::File;
//! use std::convert::TryFrom;
//! use std::convert::From;
//!
//! fn main() {
Expand Down Expand Up @@ -321,8 +319,6 @@
//! [PDF X/3 technical notes](http://www.pdfxreport.com/lib/exe/fetch.php?media=en:technote_pdfx_checks.pdf)
//!
#![feature(try_from)]

#![allow(unused_doc_comment)]
#![allow(unused_variables)]
#![allow(dead_code)]
Expand Down
7 changes: 3 additions & 4 deletions src/types/pdf_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,13 @@ impl PdfLayerReference {

/// Add an svg element to the layer
/// To be called from the `svg.add_to_layer()` class (see `use_xobject` documentation)
pub(crate) fn add_svg<T>(&self, form: T)
-> std::result::Result<XObjectRef, T::Error>
where T: std::convert::TryInto<FormXObject>
pub(crate) fn add_svg(&self, svg: Svg)
-> std::result::Result<XObjectRef, ::std::io::Error>
{
let doc = self.document.upgrade().unwrap();
let mut doc = doc.borrow_mut();
let page_mut = &mut doc.pages[self.page.0];
let form_data = form.try_into()?;
let form_data = svg.try_into()?;
Ok(page_mut.add_xobject(XObject::Form(Box::new(form_data))))
}

Expand Down
6 changes: 1 addition & 5 deletions src/types/plugins/graphics/two_dimensional/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,8 @@ impl Svg {

Ok(())
}
}

impl std::convert::TryInto<FormXObject> for Svg {
type Error = std::io::Error;

fn try_into(self)
pub fn try_into(self)
-> std::result::Result<FormXObject, std::io::Error>
{
let content = lopdf::content::Content{ operations: self.operations };
Expand Down

0 comments on commit 0f74f7b

Please sign in to comment.