Skip to content

Commit

Permalink
update mrml to v3.0
Browse files Browse the repository at this point in the history
fix #11
  • Loading branch information
jonian committed Mar 7, 2024
1 parent f32fa6a commit c9c332f
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 54 deletions.
203 changes: 155 additions & 48 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ext/mrml/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Jonian Guveli <[email protected]>"]
edition = "2018"

[dependencies]
mrml = "1.2"
mrml = "3.0"
magnus = "0.5"

[dependencies.serde]
Expand Down
10 changes: 5 additions & 5 deletions ext/mrml/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use magnus::{
Error, ExceptionClass, RModule
};

use mrml::mjml::MJML;
use mrml::mjml::Mjml;
use mrml::prelude::print::Print;
use mrml::prelude::render::Options;
use mrml::prelude::render::RenderOptions;

fn mrml_error() -> ExceptionClass {
*memoize!(ExceptionClass: {
Expand All @@ -24,7 +24,7 @@ macro_rules! error {

#[magnus::wrap(class = "MRML::Template", free_immediately, size)]
struct Template {
res: MJML
res: Mjml
}

impl Template {
Expand All @@ -36,7 +36,7 @@ impl Template {
}

fn from_json(input: String) -> Result<Self, Error> {
match serde_json::from_str::<MJML>(&input) {
match serde_json::from_str::<Mjml>(&input) {
Ok(res) => Ok(Self { res }),
Err(ex) => Err(error!(ex))
}
Expand All @@ -62,7 +62,7 @@ impl Template {
}

fn to_html(&self) -> Result<String, Error> {
match self.res.render(&Options::default()) {
match self.res.render(&RenderOptions::default()) {
Ok(res) => Ok(res),
Err(ex) => Err(error!(ex))
}
Expand Down

0 comments on commit c9c332f

Please sign in to comment.