blob: f9aef19ef84fc86d536cbf77a833b381dec53f7e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
pub struct Ticket {
title: String,
description: String,
status: String,
}
impl Ticket {
fn title(&self) -> &str {
self.title.as_str()
}
fn description(&self) -> &str {
self.description.as_str()
}
fn status(&self) -> &str {
self.status.as_str()
}
}
fn main() {
println!("");
}
#[cfg(test)]
mod tests {
use crate::*;
use std::any::{Any, TypeId};
#[test]
fn t0() {
let t = Ticket{
title: String::from("t"),
description: String::from("d"),
status: String::from("s"),
};
assert_eq!(TypeId::of::<str>(), t.title().type_id());
assert_eq!(TypeId::of::<str>(), t.description().type_id());
assert_eq!(TypeId::of::<str>(), t.status().type_id());
}
}
|