rjini/lib.rs
1mod ops;
2
3/// `Jini` is a struct that has a single field called `body` that is a `String`.
4///
5/// Properties:
6///
7/// * `body`: The body of the Jini.
8#[derive(Debug)]
9pub struct RJini {
10 pub xpath: String,
11}
12
13/// It's defining a function called `empty` that returns a new `Jini` with an empty body.
14impl RJini {
15 /// `empty()` returns a `Jini` struct with an empty `body` field
16 ///
17 /// Returns:
18 ///
19 /// A Jini struct with an empty body.
20 ///
21 /// For example:
22 /// ```
23 /// use rjini::RJini;
24 /// let j = RJini::empty();
25 /// assert_eq!("", j.xpath)
26 /// ```
27 pub fn empty() -> Self {
28 RJini {
29 xpath: "".to_string(),
30 }
31 }
32}
33
34#[cfg(test)]
35use anyhow::Result;
36
37#[test]
38fn check_creates_empty_rjini() -> Result<()> {
39 let j = RJini::empty();
40 assert_eq!("", j.xpath);
41 Ok(())
42}