emit_core/or.rs
1/*!
2The [`Or`] type.
3*/
4
5/**
6Two values combined by or-ing.
7*/
8pub struct Or<T, U> {
9 left: T,
10 right: U,
11}
12
13impl<T, U> Or<T, U> {
14 /**
15 Or two values together.
16 */
17 pub const fn new(left: T, right: U) -> Self {
18 Or { left, right }
19 }
20
21 /**
22 Get a reference to the first, or left-hand side.
23 */
24 pub const fn left(&self) -> &T {
25 &self.left
26 }
27
28 /**
29 Get a mutable reference to the first, or left-hand side.
30 */
31 pub fn left_mut(&mut self) -> &mut T {
32 &mut self.left
33 }
34
35 /**
36 Get a reference to the second, or right-hand side.
37 */
38 pub const fn right(&self) -> &U {
39 &self.right
40 }
41
42 /**
43 Get a mutable reference to the second, or right-hand side.
44 */
45 pub fn right_mut(&mut self) -> &mut U {
46 &mut self.right
47 }
48
49 /**
50 Split the combined values.
51 */
52 pub fn into_inner(self) -> (T, U) {
53 (self.left, self.right)
54 }
55}