1use crate::Object;
2use crate::Int;
3use crate::Float;
4use crate::_String;
6use crate::Char;
7use crate::Bool;
8
9
10use super::List;
11
12
13pub trait Append<T>: Sized {
16 fn append_back(&mut self, _: T) -> &mut Self;
18}
19
20
21impl Append<i32> for List {
37 fn append_back(&mut self, _integer: i32) -> &mut Self {
38 self._list.push_back(Object::Int32(Int::new(_integer)));
39 self
40 }
41}
42
43impl Append<i64> for List {
44 fn append_back(&mut self, _integer: i64) -> &mut Self {
45 self._list.push_back(Object::Int64(Int::new(_integer)));
46 self
47 }
48}
49
50
51impl Append<Int<i32>> for List {
52 fn append_back(&mut self, _integer: Int<i32>) -> &mut Self {
53 self._list.push_back(Object::Int32(_integer));
54 self
55 }
56}
57
58impl Append<Int<i64>> for List {
59 fn append_back(&mut self, _integer: Int<i64>) -> &mut Self {
60 self._list.push_back(Object::Int64(_integer));
61 self
62 }
63}
64
65impl Append<Float<f32>> for List {
85 fn append_back(&mut self, _float: Float<f32>) -> &mut Self {
86 self._list.push_back(Object::Float32(_float));
87 self
88 }
89}
90
91impl Append<Float<f64>> for List {
92 fn append_back(&mut self, _float: Float<f64>) -> &mut Self {
93 self._list.push_back(Object::Float64(_float));
94 self
95 }
96}
97
98impl Append<f64> for List {
99 fn append_back(&mut self, _float: f64) -> &mut Self {
100 self._list.push_back(Object::Float64(Float::new(_float)));
101 self
102 }
103}
104
105
106impl Append<&str> for List {
107 fn append_back(&mut self, _str: &str) -> &mut Self {
108 self._list.push_back(Object::String(_String::from(_str)));
109 self
110 }
111}
112
113
114impl Append<char> for List {
115 fn append_back(&mut self, _char: char) -> &mut Self {
116 self._list.push_back(Object::Char(Char::from(_char)));
117 self
118 }
119}
120
121impl Append<f32> for List {
122 fn append_back(&mut self, _float: f32) -> &mut Self {
123 self._list.push_back(Object::Float32(Float::from(_float)));
124 self
125 }
126}
127
128
129impl Append<String> for List {
130 fn append_back(&mut self, string: String) -> &mut Self {
131 self._list.push_back(Object::String(_String::from(string)));
132 self
133 }
134}
135
136impl Append<_String> for List {
137 fn append_back(&mut self, _string: _String) -> &mut Self {
138 self._list.push_back(Object::String(_string));
139 self
140 }
141}
142
143impl Append<bool> for List {
144 fn append_back(&mut self, _bool: bool) -> &mut Self {
145 self._list.push_back(Object::Bool(Bool::new(_bool)));
146 self
147 }
148}
149
150
151impl Append<Bool> for List {
152 #[doc = include_str!("../../docs/python_list/append_pbool.md")]
153 fn append_back(&mut self, _bool: Bool) -> &mut Self {
154 self._list.push_back(Object::Bool(_bool));
155 self
156 }
157}
158
159impl Append<List> for List {
160 fn append_back(&mut self, _list: List) -> &mut Self {
161 self._list.push_back(Object::List(_list));
162 self
163 }
164}
165
166impl Append<Object> for List {
167 fn append_back(&mut self, object: Object) -> &mut Self {
168 self._list.push_back(object);
169 self
170 }
171}