]> git.lizzy.rs Git - rust.git/blob - src/libcore/marker.rs
remove implementation detail from doc
[rust.git] / src / libcore / marker.rs
1 // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 //! Primitive traits and types representing basic properties of types.
12 //!
13 //! Rust types can be classified in various useful ways according to
14 //! their intrinsic properties. These classifications are represented
15 //! as traits.
16
17 #![stable(feature = "rust1", since = "1.0.0")]
18
19 use cell::UnsafeCell;
20 use cmp;
21 use hash::Hash;
22 use hash::Hasher;
23
24 /// Types that can be transferred across thread boundaries.
25 ///
26 /// This trait is automatically implemented when the compiler determines it's
27 /// appropriate.
28 ///
29 /// An example of a non-`Send` type is the reference-counting pointer
30 /// [`rc::Rc`][`Rc`]. If two threads attempt to clone [`Rc`]s that point to the same
31 /// reference-counted value, they might try to update the reference count at the
32 /// same time, which is [undefined behavior][ub] because [`Rc`] doesn't use atomic
33 /// operations. Its cousin [`sync::Arc`][arc] does use atomic operations (incurring
34 /// some overhead) and thus is `Send`.
35 ///
36 /// See [the Nomicon](../../nomicon/send-and-sync.html) for more details.
37 ///
38 /// [`Rc`]: ../../std/rc/struct.Rc.html
39 /// [arc]: ../../std/sync/struct.Arc.html
40 /// [ub]: ../../reference/behavior-considered-undefined.html
41 #[stable(feature = "rust1", since = "1.0.0")]
42 #[rustc_on_unimplemented = "`{Self}` cannot be sent between threads safely"]
43 pub unsafe trait Send {
44     // empty.
45 }
46
47 #[stable(feature = "rust1", since = "1.0.0")]
48 #[allow(unknown_lints)]
49 #[allow(auto_impl)]
50 unsafe impl Send for .. { }
51
52 #[stable(feature = "rust1", since = "1.0.0")]
53 impl<T: ?Sized> !Send for *const T { }
54 #[stable(feature = "rust1", since = "1.0.0")]
55 impl<T: ?Sized> !Send for *mut T { }
56
57 /// Types with a constant size known at compile time.
58 ///
59 /// All type parameters have an implicit bound of `Sized`. The special syntax
60 /// `?Sized` can be used to remove this bound if it's not appropriate.
61 ///
62 /// ```
63 /// # #![allow(dead_code)]
64 /// struct Foo<T>(T);
65 /// struct Bar<T: ?Sized>(T);
66 ///
67 /// // struct FooUse(Foo<[i32]>); // error: Sized is not implemented for [i32]
68 /// struct BarUse(Bar<[i32]>); // OK
69 /// ```
70 ///
71 /// The one exception is the implicit `Self` type of a trait, which does not
72 /// get an implicit `Sized` bound. This is because a `Sized` bound prevents
73 /// the trait from being used to form a [trait object]:
74 ///
75 /// ```
76 /// # #![allow(unused_variables)]
77 /// trait Foo { }
78 /// trait Bar: Sized { }
79 ///
80 /// struct Impl;
81 /// impl Foo for Impl { }
82 /// impl Bar for Impl { }
83 ///
84 /// let x: &Foo = &Impl;    // OK
85 /// // let y: &Bar = &Impl; // error: the trait `Bar` cannot
86 ///                         // be made into an object
87 /// ```
88 ///
89 /// [trait object]: ../../book/first-edition/trait-objects.html
90 #[stable(feature = "rust1", since = "1.0.0")]
91 #[lang = "sized"]
92 #[rustc_on_unimplemented = "`{Self}` does not have a constant size known at compile-time"]
93 #[fundamental] // for Default, for example, which requires that `[T]: !Default` be evaluatable
94 pub trait Sized {
95     // Empty.
96 }
97
98 /// Types that can be "unsized" to a dynamically-sized type.
99 ///
100 /// For example, the sized array type `[i8; 2]` implements `Unsize<[i8]>` and
101 /// `Unsize<fmt::Debug>`.
102 ///
103 /// All implementations of `Unsize` are provided automatically by the compiler.
104 ///
105 /// `Unsize` is implemented for:
106 ///
107 /// - `[T; N]` is `Unsize<[T]>`
108 /// - `T` is `Unsize<Trait>` when `T: Trait`
109 /// - `Foo<..., T, ...>` is `Unsize<Foo<..., U, ...>>` if:
110 ///   - `T: Unsize<U>`
111 ///   - Foo is a struct
112 ///   - Only the last field of `Foo` has a type involving `T`
113 ///   - `T` is not part of the type of any other fields
114 ///   - `Bar<T>: Unsize<Bar<U>>`, if the last field of `Foo` has type `Bar<T>`
115 ///
116 /// `Unsize` is used along with [`ops::CoerceUnsized`][coerceunsized] to allow
117 /// "user-defined" containers such as [`rc::Rc`][rc] to contain dynamically-sized
118 /// types. See the [DST coercion RFC][RFC982] and [the nomicon entry on coercion][nomicon-coerce]
119 /// for more details.
120 ///
121 /// [coerceunsized]: ../ops/trait.CoerceUnsized.html
122 /// [rc]: ../../std/rc/struct.Rc.html
123 /// [RFC982]: https://github.com/rust-lang/rfcs/blob/master/text/0982-dst-coercion.md
124 /// [nomicon-coerce]: ../../nomicon/coercions.html
125 #[unstable(feature = "unsize", issue = "27732")]
126 #[lang = "unsize"]
127 pub trait Unsize<T: ?Sized> {
128     // Empty.
129 }
130
131 /// Types whose values can be duplicated simply by copying bits.
132 ///
133 /// By default, variable bindings have 'move semantics.' In other
134 /// words:
135 ///
136 /// ```
137 /// #[derive(Debug)]
138 /// struct Foo;
139 ///
140 /// let x = Foo;
141 ///
142 /// let y = x;
143 ///
144 /// // `x` has moved into `y`, and so cannot be used
145 ///
146 /// // println!("{:?}", x); // error: use of moved value
147 /// ```
148 ///
149 /// However, if a type implements `Copy`, it instead has 'copy semantics':
150 ///
151 /// ```
152 /// // We can derive a `Copy` implementation. `Clone` is also required, as it's
153 /// // a supertrait of `Copy`.
154 /// #[derive(Debug, Copy, Clone)]
155 /// struct Foo;
156 ///
157 /// let x = Foo;
158 ///
159 /// let y = x;
160 ///
161 /// // `y` is a copy of `x`
162 ///
163 /// println!("{:?}", x); // A-OK!
164 /// ```
165 ///
166 /// It's important to note that in these two examples, the only difference is whether you
167 /// are allowed to access `x` after the assignment. Under the hood, both a copy and a move
168 /// can result in bits being copied in memory, although this is sometimes optimized away.
169 ///
170 /// ## How can I implement `Copy`?
171 ///
172 /// There are two ways to implement `Copy` on your type. The simplest is to use `derive`:
173 ///
174 /// ```
175 /// #[derive(Copy, Clone)]
176 /// struct MyStruct;
177 /// ```
178 ///
179 /// You can also implement `Copy` and `Clone` manually:
180 ///
181 /// ```
182 /// struct MyStruct;
183 ///
184 /// impl Copy for MyStruct { }
185 ///
186 /// impl Clone for MyStruct {
187 ///     fn clone(&self) -> MyStruct {
188 ///         *self
189 ///     }
190 /// }
191 /// ```
192 ///
193 /// There is a small difference between the two: the `derive` strategy will also place a `Copy`
194 /// bound on type parameters, which isn't always desired.
195 ///
196 /// ## What's the difference between `Copy` and `Clone`?
197 ///
198 /// Copies happen implicitly, for example as part of an assignment `y = x`. The behavior of
199 /// `Copy` is not overloadable; it is always a simple bit-wise copy.
200 ///
201 /// Cloning is an explicit action, `x.clone()`. The implementation of [`Clone`] can
202 /// provide any type-specific behavior necessary to duplicate values safely. For example,
203 /// the implementation of [`Clone`] for [`String`] needs to copy the pointed-to string
204 /// buffer in the heap. A simple bitwise copy of [`String`] values would merely copy the
205 /// pointer, leading to a double free down the line. For this reason, [`String`] is [`Clone`]
206 /// but not `Copy`.
207 ///
208 /// [`Clone`] is a supertrait of `Copy`, so everything which is `Copy` must also implement
209 /// [`Clone`]. If a type is `Copy` then its [`Clone`] implementation only needs to return `*self`
210 /// (see the example above).
211 ///
212 /// ## When can my type be `Copy`?
213 ///
214 /// A type can implement `Copy` if all of its components implement `Copy`. For example, this
215 /// struct can be `Copy`:
216 ///
217 /// ```
218 /// # #[allow(dead_code)]
219 /// struct Point {
220 ///    x: i32,
221 ///    y: i32,
222 /// }
223 /// ```
224 ///
225 /// A struct can be `Copy`, and [`i32`] is `Copy`, therefore `Point` is eligible to be `Copy`.
226 /// By contrast, consider
227 ///
228 /// ```
229 /// # #![allow(dead_code)]
230 /// # struct Point;
231 /// struct PointList {
232 ///     points: Vec<Point>,
233 /// }
234 /// ```
235 ///
236 /// The struct `PointList` cannot implement `Copy`, because [`Vec<T>`] is not `Copy`. If we
237 /// attempt to derive a `Copy` implementation, we'll get an error:
238 ///
239 /// ```text
240 /// the trait `Copy` may not be implemented for this type; field `points` does not implement `Copy`
241 /// ```
242 ///
243 /// ## When *can't* my type be `Copy`?
244 ///
245 /// Some types can't be copied safely. For example, copying `&mut T` would create an aliased
246 /// mutable reference. Copying [`String`] would duplicate responsibility for managing the
247 /// [`String`]'s buffer, leading to a double free.
248 ///
249 /// Generalizing the latter case, any type implementing [`Drop`] can't be `Copy`, because it's
250 /// managing some resource besides its own [`size_of::<T>`] bytes.
251 ///
252 /// If you try to implement `Copy` on a struct or enum containing non-`Copy` data, you will get
253 /// the error [E0204].
254 ///
255 /// [E0204]: ../../error-index.html#E0204
256 ///
257 /// ## When *should* my type be `Copy`?
258 ///
259 /// Generally speaking, if your type _can_ implement `Copy`, it should. Keep in mind, though,
260 /// that implementing `Copy` is part of the public API of your type. If the type might become
261 /// non-`Copy` in the future, it could be prudent to omit the `Copy` implementation now, to
262 /// avoid a breaking API change.
263 ///
264 /// [`Vec<T>`]: ../../std/vec/struct.Vec.html
265 /// [`String`]: ../../std/string/struct.String.html
266 /// [`Drop`]: ../../std/ops/trait.Drop.html
267 /// [`size_of::<T>`]: ../../std/mem/fn.size_of.html
268 /// [`Clone`]: ../clone/trait.Clone.html
269 /// [`String`]: ../../std/string/struct.String.html
270 /// [`i32`]: ../../std/primitive.i32.html
271 #[stable(feature = "rust1", since = "1.0.0")]
272 #[lang = "copy"]
273 pub trait Copy : Clone {
274     // Empty.
275 }
276
277 /// Types for which it is safe to share references between threads.
278 ///
279 /// This trait is automatically implemented when the compiler determines
280 /// it's appropriate.
281 ///
282 /// The precise definition is: a type `T` is `Sync` if `&T` is
283 /// [`Send`][send]. In other words, if there is no possibility of
284 /// [undefined behavior][ub] (including data races) when passing
285 /// `&T` references between threads.
286 ///
287 /// As one would expect, primitive types like [`u8`][u8] and [`f64`][f64]
288 /// are all `Sync`, and so are simple aggregate types containing them,
289 /// like tuples, structs and enums. More examples of basic `Sync`
290 /// types include "immutable" types like `&T`, and those with simple
291 /// inherited mutability, such as [`Box<T>`][box], [`Vec<T>`][vec] and
292 /// most other collection types. (Generic parameters need to be `Sync`
293 /// for their container to be `Sync`.)
294 ///
295 /// A somewhat surprising consequence of the definition is that `&mut T`
296 /// is `Sync` (if `T` is `Sync`) even though it seems like that might
297 /// provide unsynchronized mutation. The trick is that a mutable
298 /// reference behind a shared reference (that is, `& &mut T`)
299 /// becomes read-only, as if it were a `& &T`. Hence there is no risk
300 /// of a data race.
301 ///
302 /// Types that are not `Sync` are those that have "interior
303 /// mutability" in a non-thread-safe form, such as [`cell::Cell`][cell]
304 /// and [`cell::RefCell`][refcell]. These types allow for mutation of
305 /// their contents even through an immutable, shared reference. For
306 /// example the `set` method on [`Cell<T>`][cell] takes `&self`, so it requires
307 /// only a shared reference [`&Cell<T>`][cell]. The method performs no
308 /// synchronization, thus [`Cell`][cell] cannot be `Sync`.
309 ///
310 /// Another example of a non-`Sync` type is the reference-counting
311 /// pointer [`rc::Rc`][rc]. Given any reference [`&Rc<T>`][rc], you can clone
312 /// a new [`Rc<T>`][rc], modifying the reference counts in a non-atomic way.
313 ///
314 /// For cases when one does need thread-safe interior mutability,
315 /// Rust provides [atomic data types], as well as explicit locking via
316 /// [`sync::Mutex`][mutex] and [`sync::RwLock`][rwlock]. These types
317 /// ensure that any mutation cannot cause data races, hence the types
318 /// are `Sync`. Likewise, [`sync::Arc`][arc] provides a thread-safe
319 /// analogue of [`Rc`][rc].
320 ///
321 /// Any types with interior mutability must also use the
322 /// [`cell::UnsafeCell`][unsafecell] wrapper around the value(s) which
323 /// can be mutated through a shared reference. Failing to doing this is
324 /// [undefined behavior][ub]. For example, [`transmute`][transmute]-ing
325 /// from `&T` to `&mut T` is invalid.
326 ///
327 /// See [the Nomicon](../../nomicon/send-and-sync.html) for more
328 /// details about `Sync`.
329 ///
330 /// [send]: trait.Send.html
331 /// [u8]: ../../std/primitive.u8.html
332 /// [f64]: ../../std/primitive.f64.html
333 /// [box]: ../../std/boxed/struct.Box.html
334 /// [vec]: ../../std/vec/struct.Vec.html
335 /// [cell]: ../cell/struct.Cell.html
336 /// [refcell]: ../cell/struct.RefCell.html
337 /// [rc]: ../../std/rc/struct.Rc.html
338 /// [arc]: ../../std/sync/struct.Arc.html
339 /// [atomic data types]: ../sync/atomic/index.html
340 /// [mutex]: ../../std/sync/struct.Mutex.html
341 /// [rwlock]: ../../std/sync/struct.RwLock.html
342 /// [unsafecell]: ../cell/struct.UnsafeCell.html
343 /// [ub]: ../../reference/behavior-considered-undefined.html
344 /// [transmute]: ../../std/mem/fn.transmute.html
345 #[stable(feature = "rust1", since = "1.0.0")]
346 #[lang = "sync"]
347 #[rustc_on_unimplemented = "`{Self}` cannot be shared between threads safely"]
348 pub unsafe trait Sync {
349     // Empty
350 }
351
352 #[stable(feature = "rust1", since = "1.0.0")]
353 #[allow(unknown_lints)]
354 #[allow(auto_impl)]
355 unsafe impl Sync for .. { }
356
357 #[stable(feature = "rust1", since = "1.0.0")]
358 impl<T: ?Sized> !Sync for *const T { }
359 #[stable(feature = "rust1", since = "1.0.0")]
360 impl<T: ?Sized> !Sync for *mut T { }
361
362 macro_rules! impls{
363     ($t: ident) => (
364         #[stable(feature = "rust1", since = "1.0.0")]
365         impl<T:?Sized> Hash for $t<T> {
366             #[inline]
367             fn hash<H: Hasher>(&self, _: &mut H) {
368             }
369         }
370
371         #[stable(feature = "rust1", since = "1.0.0")]
372         impl<T:?Sized> cmp::PartialEq for $t<T> {
373             fn eq(&self, _other: &$t<T>) -> bool {
374                 true
375             }
376         }
377
378         #[stable(feature = "rust1", since = "1.0.0")]
379         impl<T:?Sized> cmp::Eq for $t<T> {
380         }
381
382         #[stable(feature = "rust1", since = "1.0.0")]
383         impl<T:?Sized> cmp::PartialOrd for $t<T> {
384             fn partial_cmp(&self, _other: &$t<T>) -> Option<cmp::Ordering> {
385                 Option::Some(cmp::Ordering::Equal)
386             }
387         }
388
389         #[stable(feature = "rust1", since = "1.0.0")]
390         impl<T:?Sized> cmp::Ord for $t<T> {
391             fn cmp(&self, _other: &$t<T>) -> cmp::Ordering {
392                 cmp::Ordering::Equal
393             }
394         }
395
396         #[stable(feature = "rust1", since = "1.0.0")]
397         impl<T:?Sized> Copy for $t<T> { }
398
399         #[stable(feature = "rust1", since = "1.0.0")]
400         impl<T:?Sized> Clone for $t<T> {
401             fn clone(&self) -> $t<T> {
402                 $t
403             }
404         }
405
406         #[stable(feature = "rust1", since = "1.0.0")]
407         impl<T:?Sized> Default for $t<T> {
408             fn default() -> $t<T> {
409                 $t
410             }
411         }
412         )
413 }
414
415 /// Zero-sized type used to mark things that "act like" they own a `T`.
416 ///
417 /// Adding a `PhantomData<T>` field to your type tells the compiler that your
418 /// type acts as though it stores a value of type `T`, even though it doesn't
419 /// really. This information is used when computing certain safety properties.
420 ///
421 /// For a more in-depth explanation of how to use `PhantomData<T>`, please see
422 /// [the Nomicon](../../nomicon/phantom-data.html).
423 ///
424 /// # A ghastly note ðŸ‘»ðŸ‘»ðŸ‘»
425 ///
426 /// Though they both have scary names, `PhantomData` and 'phantom types' are
427 /// related, but not identical. A phantom type parameter is simply a type
428 /// parameter which is never used. In Rust, this often causes the compiler to
429 /// complain, and the solution is to add a "dummy" use by way of `PhantomData`.
430 ///
431 /// # Examples
432 ///
433 /// ## Unused lifetime parameters
434 ///
435 /// Perhaps the most common use case for `PhantomData` is a struct that has an
436 /// unused lifetime parameter, typically as part of some unsafe code. For
437 /// example, here is a struct `Slice` that has two pointers of type `*const T`,
438 /// presumably pointing into an array somewhere:
439 ///
440 /// ```compile_fail,E0392
441 /// struct Slice<'a, T> {
442 ///     start: *const T,
443 ///     end: *const T,
444 /// }
445 /// ```
446 ///
447 /// The intention is that the underlying data is only valid for the
448 /// lifetime `'a`, so `Slice` should not outlive `'a`. However, this
449 /// intent is not expressed in the code, since there are no uses of
450 /// the lifetime `'a` and hence it is not clear what data it applies
451 /// to. We can correct this by telling the compiler to act *as if* the
452 /// `Slice` struct contained a reference `&'a T`:
453 ///
454 /// ```
455 /// use std::marker::PhantomData;
456 ///
457 /// # #[allow(dead_code)]
458 /// struct Slice<'a, T: 'a> {
459 ///     start: *const T,
460 ///     end: *const T,
461 ///     phantom: PhantomData<&'a T>,
462 /// }
463 /// ```
464 ///
465 /// This also in turn requires the annotation `T: 'a`, indicating
466 /// that any references in `T` are valid over the lifetime `'a`.
467 ///
468 /// When initializing a `Slice` you simply provide the value
469 /// `PhantomData` for the field `phantom`:
470 ///
471 /// ```
472 /// # #![allow(dead_code)]
473 /// # use std::marker::PhantomData;
474 /// # struct Slice<'a, T: 'a> {
475 /// #     start: *const T,
476 /// #     end: *const T,
477 /// #     phantom: PhantomData<&'a T>,
478 /// # }
479 /// fn borrow_vec<'a, T>(vec: &'a Vec<T>) -> Slice<'a, T> {
480 ///     let ptr = vec.as_ptr();
481 ///     Slice {
482 ///         start: ptr,
483 ///         end: unsafe { ptr.offset(vec.len() as isize) },
484 ///         phantom: PhantomData,
485 ///     }
486 /// }
487 /// ```
488 ///
489 /// ## Unused type parameters
490 ///
491 /// It sometimes happens that you have unused type parameters which
492 /// indicate what type of data a struct is "tied" to, even though that
493 /// data is not actually found in the struct itself. Here is an
494 /// example where this arises with [FFI]. The foreign interface uses
495 /// handles of type `*mut ()` to refer to Rust values of different
496 /// types. We track the Rust type using a phantom type parameter on
497 /// the struct `ExternalResource` which wraps a handle.
498 ///
499 /// [FFI]: ../../book/first-edition/ffi.html
500 ///
501 /// ```
502 /// # #![allow(dead_code)]
503 /// # trait ResType { }
504 /// # struct ParamType;
505 /// # mod foreign_lib {
506 /// #     pub fn new(_: usize) -> *mut () { 42 as *mut () }
507 /// #     pub fn do_stuff(_: *mut (), _: usize) {}
508 /// # }
509 /// # fn convert_params(_: ParamType) -> usize { 42 }
510 /// use std::marker::PhantomData;
511 /// use std::mem;
512 ///
513 /// struct ExternalResource<R> {
514 ///    resource_handle: *mut (),
515 ///    resource_type: PhantomData<R>,
516 /// }
517 ///
518 /// impl<R: ResType> ExternalResource<R> {
519 ///     fn new() -> ExternalResource<R> {
520 ///         let size_of_res = mem::size_of::<R>();
521 ///         ExternalResource {
522 ///             resource_handle: foreign_lib::new(size_of_res),
523 ///             resource_type: PhantomData,
524 ///         }
525 ///     }
526 ///
527 ///     fn do_stuff(&self, param: ParamType) {
528 ///         let foreign_params = convert_params(param);
529 ///         foreign_lib::do_stuff(self.resource_handle, foreign_params);
530 ///     }
531 /// }
532 /// ```
533 ///
534 /// ## Ownership and the drop check
535 ///
536 /// Adding a field of type `PhantomData<T>` indicates that your
537 /// type owns data of type `T`. This in turn implies that when your
538 /// type is dropped, it may drop one or more instances of the type
539 /// `T`. This has bearing on the Rust compiler's [drop check]
540 /// analysis.
541 ///
542 /// If your struct does not in fact *own* the data of type `T`, it is
543 /// better to use a reference type, like `PhantomData<&'a T>`
544 /// (ideally) or `PhantomData<*const T>` (if no lifetime applies), so
545 /// as not to indicate ownership.
546 ///
547 /// [drop check]: ../../nomicon/dropck.html
548 #[lang = "phantom_data"]
549 #[stable(feature = "rust1", since = "1.0.0")]
550 pub struct PhantomData<T:?Sized>;
551
552 impls! { PhantomData }
553
554 mod impls {
555     #[stable(feature = "rust1", since = "1.0.0")]
556     unsafe impl<'a, T: Sync + ?Sized> Send for &'a T {}
557     #[stable(feature = "rust1", since = "1.0.0")]
558     unsafe impl<'a, T: Send + ?Sized> Send for &'a mut T {}
559 }
560
561 /// Compiler-internal trait used to determine whether a type contains
562 /// any `UnsafeCell` internally, but not through an indirection.
563 /// This affects, for example, whether a `static` of that type is
564 /// placed in read-only static memory or writable static memory.
565 #[lang = "freeze"]
566 unsafe trait Freeze {}
567
568 #[allow(unknown_lints)]
569 #[allow(auto_impl)]
570 unsafe impl Freeze for .. {}
571
572 impl<T: ?Sized> !Freeze for UnsafeCell<T> {}
573 unsafe impl<T: ?Sized> Freeze for PhantomData<T> {}
574 unsafe impl<T: ?Sized> Freeze for *const T {}
575 unsafe impl<T: ?Sized> Freeze for *mut T {}
576 unsafe impl<'a, T: ?Sized> Freeze for &'a T {}
577 unsafe impl<'a, T: ?Sized> Freeze for &'a mut T {}