mustachers 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '068bfa54966df4c3f5381c0a9c6902e0000f6389a282f3b4642215cda748ddd2'
4
- data.tar.gz: 3932012e370d111c987378c7836d21d3f318309116968c774a4e49d3a403b43d
3
+ metadata.gz: cc57997a63b93179ce9d164bc6da86c8ea4e321e50fe84e0cad84038a3cc0696
4
+ data.tar.gz: 12f3788a143cabd67f9d69d7d58848ec746ee587edb816c544298dd8022dcb88
5
5
  SHA512:
6
- metadata.gz: 030c2c4f07b84f7679de5a9bc03a47be9c4018aaf85fcde6eaa2d6ee181485eef52ef7c261104d3226ef8cb1668d39bc90e5fb07f0646604342861c9bccf33f5
7
- data.tar.gz: 234af7c4705e126864aa567e2cc618c8aa40b8d811c4ec26641a2a00e0905884307779042434a32d6d7af5a5f5bbf450d3010b6eafcb5db3b3e9891071e95f09
6
+ metadata.gz: 24d454671334626951c12790967430665a371c21cef37321092fac065f64c6ad0d5fb5c9a1689de5d93833e76aff23341d02cd286658f1d6b549f18aae77507f
7
+ data.tar.gz: 7b3eba90f6370d1185dccaf094bb707c4752cf3bcd67941dbba56977cad66d12863724a9502898068ca20de9099fbf51ef414df16e94369cadc3b221cd5b9ff7
data/Cargo.lock CHANGED
@@ -1,6 +1,6 @@
1
1
  # This file is automatically @generated by Cargo.
2
2
  # It is not intended for manual editing.
3
- version = 3
3
+ version = 4
4
4
 
5
5
  [[package]]
6
6
  name = "aho-corasick"
@@ -13,16 +13,16 @@ dependencies = [
13
13
 
14
14
  [[package]]
15
15
  name = "bindgen"
16
- version = "0.62.0"
16
+ version = "0.69.5"
17
17
  source = "registry+https://github.com/rust-lang/crates.io-index"
18
- checksum = "c6720a8b7b2d39dd533285ed438d458f65b31b5c257e6ac7bb3d7e82844dd722"
18
+ checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088"
19
19
  dependencies = [
20
20
  "bitflags",
21
21
  "cexpr",
22
22
  "clang-sys",
23
+ "itertools",
23
24
  "lazy_static",
24
25
  "lazycell",
25
- "peeking_take_while",
26
26
  "proc-macro2",
27
27
  "quote",
28
28
  "regex",
@@ -33,9 +33,9 @@ dependencies = [
33
33
 
34
34
  [[package]]
35
35
  name = "bitflags"
36
- version = "1.3.2"
36
+ version = "2.9.3"
37
37
  source = "registry+https://github.com/rust-lang/crates.io-index"
38
- checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
38
+ checksum = "34efbcccd345379ca2868b2b2c9d3782e9cc58ba87bc7d79d5b53d9c9ae6f25d"
39
39
 
40
40
  [[package]]
41
41
  name = "cexpr"
@@ -63,12 +63,27 @@ dependencies = [
63
63
  "libloading",
64
64
  ]
65
65
 
66
+ [[package]]
67
+ name = "either"
68
+ version = "1.15.0"
69
+ source = "registry+https://github.com/rust-lang/crates.io-index"
70
+ checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
71
+
66
72
  [[package]]
67
73
  name = "glob"
68
74
  version = "0.3.1"
69
75
  source = "registry+https://github.com/rust-lang/crates.io-index"
70
76
  checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
71
77
 
78
+ [[package]]
79
+ name = "itertools"
80
+ version = "0.12.1"
81
+ source = "registry+https://github.com/rust-lang/crates.io-index"
82
+ checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
83
+ dependencies = [
84
+ "either",
85
+ ]
86
+
72
87
  [[package]]
73
88
  name = "lazy_static"
74
89
  version = "1.4.0"
@@ -114,20 +129,21 @@ checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4"
114
129
 
115
130
  [[package]]
116
131
  name = "magnus"
117
- version = "0.4.4"
132
+ version = "0.8.0"
118
133
  source = "registry+https://github.com/rust-lang/crates.io-index"
119
- checksum = "fc87660cd7daa49fddbfd524c836de54d5c927d520cd163f43700c5087c57d6c"
134
+ checksum = "3f14d3cc31b2dc4fce6cd447a83c7a7ca2ab8a9f1e535dcb2f796ff972b0e68b"
120
135
  dependencies = [
121
136
  "magnus-macros",
122
137
  "rb-sys",
123
138
  "rb-sys-env",
139
+ "seq-macro",
124
140
  ]
125
141
 
126
142
  [[package]]
127
143
  name = "magnus-macros"
128
- version = "0.3.0"
144
+ version = "0.8.0"
129
145
  source = "registry+https://github.com/rust-lang/crates.io-index"
130
- checksum = "206cb23bfeea05180c97522ef6a3e52a4eb17b0ed2f30ee3ca9c4f994d2378ae"
146
+ checksum = "47607461fd8e1513cb4f2076c197d8092d921a1ea75bd08af97398f593751892"
131
147
  dependencies = [
132
148
  "proc-macro2",
133
149
  "quote",
@@ -174,12 +190,6 @@ dependencies = [
174
190
  "minimal-lexical",
175
191
  ]
176
192
 
177
- [[package]]
178
- name = "peeking_take_while"
179
- version = "0.1.2"
180
- source = "registry+https://github.com/rust-lang/crates.io-index"
181
- checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
182
-
183
193
  [[package]]
184
194
  name = "proc-macro2"
185
195
  version = "1.0.66"
@@ -200,18 +210,18 @@ dependencies = [
200
210
 
201
211
  [[package]]
202
212
  name = "rb-sys"
203
- version = "0.9.79"
213
+ version = "0.9.117"
204
214
  source = "registry+https://github.com/rust-lang/crates.io-index"
205
- checksum = "939fb78db3e4f26665c1d4c7b91ca66d3578335a19aba552d4a6445811d07072"
215
+ checksum = "f900d1ce4629a2ebffaf5de74bd8f9c1188d4c5ed406df02f97e22f77a006f44"
206
216
  dependencies = [
207
217
  "rb-sys-build",
208
218
  ]
209
219
 
210
220
  [[package]]
211
221
  name = "rb-sys-build"
212
- version = "0.9.79"
222
+ version = "0.9.117"
213
223
  source = "registry+https://github.com/rust-lang/crates.io-index"
214
- checksum = "335a95eb0420d52fa94ef12019df3c2c250c6b19cbb3c60bd05cb7e9c362072c"
224
+ checksum = "ef1e9c857028f631056bcd6d88cec390c751e343ce2223ddb26d23eb4a151d59"
215
225
  dependencies = [
216
226
  "bindgen",
217
227
  "lazy_static",
@@ -224,9 +234,9 @@ dependencies = [
224
234
 
225
235
  [[package]]
226
236
  name = "rb-sys-env"
227
- version = "0.1.2"
237
+ version = "0.2.2"
228
238
  source = "registry+https://github.com/rust-lang/crates.io-index"
229
- checksum = "a35802679f07360454b418a5d1735c89716bde01d35b1560fc953c1415a0b3bb"
239
+ checksum = "08f8d2924cf136a1315e2b4c7460a39f62ef11ee5d522df9b2750fab55b868b6"
230
240
 
231
241
  [[package]]
232
242
  name = "regex"
@@ -263,6 +273,12 @@ version = "1.1.0"
263
273
  source = "registry+https://github.com/rust-lang/crates.io-index"
264
274
  checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
265
275
 
276
+ [[package]]
277
+ name = "seq-macro"
278
+ version = "0.3.6"
279
+ source = "registry+https://github.com/rust-lang/crates.io-index"
280
+ checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
281
+
266
282
  [[package]]
267
283
  name = "serde"
268
284
  version = "1.0.175"
@@ -283,9 +299,9 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
283
299
 
284
300
  [[package]]
285
301
  name = "syn"
286
- version = "1.0.109"
302
+ version = "2.0.32"
287
303
  source = "registry+https://github.com/rust-lang/crates.io-index"
288
- checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
304
+ checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2"
289
305
  dependencies = [
290
306
  "proc-macro2",
291
307
  "quote",
@@ -10,5 +10,5 @@ crate-type = ["cdylib"]
10
10
  name = "mustachers"
11
11
 
12
12
  [dependencies]
13
- magnus = { version = "0.4" }
13
+ magnus = { version = "0.8" }
14
14
  mustache = "0.9.0"
@@ -1,12 +1,9 @@
1
- use magnus::{
2
- define_module, exception::runtime_error, function, prelude::*, r_hash::ForEach, Error, RHash,
3
- Symbol, Value,
4
- };
1
+ use magnus::{function, prelude::*, r_hash::ForEach, Error, RHash, RModule, Ruby, Symbol, Value};
5
2
  use std::collections::HashMap;
6
3
 
7
4
  mod renderer;
8
5
 
9
- pub fn wrapper(template: String, params: RHash) -> Result<String, Error> {
6
+ pub fn wrapper(ruby: &Ruby, template: String, params: RHash) -> Result<String, Error> {
10
7
  let mut data: HashMap<String, String> = HashMap::new();
11
8
 
12
9
  params.foreach(|key: Symbol, value: Value| {
@@ -16,13 +13,13 @@ pub fn wrapper(template: String, params: RHash) -> Result<String, Error> {
16
13
  })?;
17
14
 
18
15
  return renderer::render(template, data)
19
- .map_err(|e| Error::new(runtime_error(), e.to_string()));
16
+ .map_err(|e: std::fmt::Error| Error::new(ruby.exception_runtime_error(), e.to_string()));
20
17
  }
21
18
 
22
19
  #[magnus::init]
23
- fn init() -> Result<(), Error> {
24
- let mustachers_module = define_module("Mustachers")?;
25
- let renderer_module = mustachers_module.define_module("Renderer")?;
20
+ fn init(ruby: &Ruby) -> Result<(), Error> {
21
+ let mustachers_module: RModule = ruby.define_module("Mustachers")?;
22
+ let renderer_module: RModule = mustachers_module.define_module("Renderer")?;
26
23
 
27
24
  renderer_module.define_singleton_method("render", function!(wrapper, 2))?;
28
25
 
@@ -1,11 +1,13 @@
1
1
  use core::fmt::Error;
2
2
  use std::collections::HashMap;
3
3
 
4
+ use mustache::{compile_str, Template};
5
+
4
6
  extern crate mustache;
5
7
 
6
8
  pub fn render(template: String, params: HashMap<String, String>) -> Result<String, Error> {
7
- let template = mustache::compile_str(&template).expect("Failed to compile");
8
- let mut bytes = vec![];
9
+ let template: Template = compile_str(&template).expect("Failed to compile");
10
+ let mut bytes: Vec<u8> = vec![];
9
11
 
10
12
  template
11
13
  .render(&mut bytes, &params)
@@ -21,9 +23,9 @@ mod tests {
21
23
 
22
24
  #[test]
23
25
  fn it_interpolates_correctly() {
24
- let template =
26
+ let template: String =
25
27
  String::from("<html lang=\"{{{lang}}}\"/>{{{ top }}}{{{ middle }}}{{{ bottom }}}");
26
- let params = HashMap::from([
28
+ let params: HashMap<String, String> = HashMap::from([
27
29
  (String::from("top"), String::from("<h1>Page heading</h1>")),
28
30
  (
29
31
  String::from("middle"),
@@ -37,7 +39,7 @@ mod tests {
37
39
  (String::from("foo"), String::from("bar")),
38
40
  ]);
39
41
 
40
- let result = render(template, params).unwrap();
42
+ let result: String = render(template, params).unwrap();
41
43
  assert_eq!(result, "<html lang=\"en-GB\"/><h1>Page heading</h1><p>Paragraph of text.</p><a href=\"#about\">Page link</a>");
42
44
  }
43
45
  }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mustachers
4
- VERSION = '0.1.3'
4
+ VERSION = '0.1.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mustachers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam French
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-14 00:00:00.000000000 Z
11
+ date: 2025-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.12'
19
+ version: '3.13'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.12'
26
+ version: '3.13'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mustache
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -71,14 +71,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
- version: 2.6.0
74
+ version: 3.2.0
75
75
  required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  requirements:
77
77
  - - ">="
78
78
  - !ruby/object:Gem::Version
79
79
  version: 3.3.11
80
80
  requirements: []
81
- rubygems_version: 3.4.19
81
+ rubygems_version: 3.5.22
82
82
  signing_key:
83
83
  specification_version: 4
84
84
  summary: Mustache templating with Rust