File: lib.rs

package info (click to toggle)
rust-synstructure-test-traits 0.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 72 kB
  • sloc: makefile: 4
file content (19 lines) | stat: -rw-r--r-- 619 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//! This crate contains a series of traits which are occasionally referred to in
//! documentation examples. When these examples reference the example_traits
//! crate, they are referencing this crate.

// Used for the WalkFields example in src/lib.rs
pub trait WalkFields: std::any::Any {
    fn walk_fields(&self, walk: &mut FnMut(&WalkFields));
}
impl WalkFields for i32 {
    fn walk_fields(&self, _walk: &mut FnMut(&WalkFields)) {}
}

// Used for the Interest example in src/lib.rs
pub trait Interest {
    fn interesting(&self) -> bool;
}
impl Interest for i32 {
    fn interesting(&self) -> bool { *self > 0 }
}