|
| 1 | +--- |
| 2 | +title: "struct.Map" |
| 3 | +--- |
| 4 | + |
| 5 | +# Struct [tauri](/docs/api/rust/tauri/../../../../index.html)::[api](/docs/api/rust/tauri/../../../index.html)::[assets](/docs/api/rust/tauri/../../index.html)::[phf](/docs/api/rust/tauri/../index.html)::[map](/docs/api/rust/tauri/index.html)::[Map](/docs/api/rust/tauri/) |
| 6 | + |
| 7 | + pub struct Map<K, V> where |
| 8 | + K: 'static, |
| 9 | + V: 'static, { /* fields omitted */ } |
| 10 | + |
| 11 | +An immutable map constructed at compile time. |
| 12 | + |
| 13 | +## [Note](/docs/api/rust/tauri/about:blank#note) |
| 14 | + |
| 15 | +The fields of this struct are public so that they may be initialized by the `phf_map!` macro and code generation. They are subject to change at any time and should never be accessed directly. |
| 16 | + |
| 17 | +## Implementations |
| 18 | + |
| 19 | +### `impl<K, V> Map<K, V>` |
| 20 | + |
| 21 | +#### `pub fn is_empty(&self) -> bool` |
| 22 | + |
| 23 | +Returns true if the `Map` is empty. |
| 24 | + |
| 25 | +#### `pub fn len(&self) -> usize` |
| 26 | + |
| 27 | +Returns the number of entries in the `Map`. |
| 28 | + |
| 29 | +#### `pub fn contains_key<T>(&self, key: &T) -> boolwhere T: Eq + PhfHash + ?Sized, K: Borrow<T>,` |
| 30 | + |
| 31 | +Determines if `key` is in the `Map`. |
| 32 | + |
| 33 | +#### `pub fn get<T>(&self, key: &T) -> Option<&V> where T: Eq + PhfHash + ?Sized, K: Borrow<T>,` |
| 34 | + |
| 35 | +Returns a reference to the value that `key` maps to. |
| 36 | + |
| 37 | +#### `pub fn get_key<T>(&self, key: &T) -> Option<&K> where T: Eq + PhfHash + ?Sized, K: Borrow<T>,` |
| 38 | + |
| 39 | +Returns a reference to the map's internal static instance of the given key. |
| 40 | + |
| 41 | +This can be useful for interning schemes. |
| 42 | + |
| 43 | +#### `pub fn get_entry<T>(&self, key: &T) -> Option<(&K, &V)> where T: Eq + PhfHash + ?Sized, K: Borrow<T>,` |
| 44 | + |
| 45 | +Like `get`, but returns both the key and the value. |
| 46 | + |
| 47 | +#### `pub fn entries(&'a self) -> Entries<'a, K, V>ⓘ Notable traits for Entries<'a, K, V> impl<'a, K, V> Iterator for Entries<'a, K, V>type Item = (&'aK, &'aV);` |
| 48 | + |
| 49 | +Returns an iterator over the key/value pairs in the map. |
| 50 | + |
| 51 | +Entries are returned in an arbitrary but fixed order. |
| 52 | + |
| 53 | +#### `pub fn keys(&'a self) -> Keys<'a, K, V>ⓘ Notable traits for Keys<'a, K, V> impl<'a, K, V> Iterator for Keys<'a, K, V>type Item = &'aK;` |
| 54 | + |
| 55 | +Returns an iterator over the keys in the map. |
| 56 | + |
| 57 | +Keys are returned in an arbitrary but fixed order. |
| 58 | + |
| 59 | +#### `pub fn values(&'a self) -> Values<'a, K, V>ⓘ Notable traits for Values<'a, K, V> impl<'a, K, V> Iterator for Values<'a, K, V>type Item = &'aV;` |
| 60 | + |
| 61 | +Returns an iterator over the values in the map. |
| 62 | + |
| 63 | +Values are returned in an arbitrary but fixed order. |
| 64 | + |
| 65 | +## Trait Implementations |
| 66 | + |
| 67 | +### `impl<K, V> Debug for Map<K, V> where K: Debug, V: Debug,` |
| 68 | + |
| 69 | +#### `pub fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>` |
| 70 | + |
| 71 | +Formats the value using the given formatter. [Read more](https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt) |
| 72 | + |
| 73 | +### `impl<'a, K, V, T> Index<&'aT> for Map<K, V> where T: Eq + PhfHash + ?Sized, K: Borrow<T>,` |
| 74 | + |
| 75 | +#### `type Output = V` |
| 76 | + |
| 77 | +The returned type after indexing. |
| 78 | + |
| 79 | +#### `pub fn index(&self, k: &'aT) -> &V` |
| 80 | + |
| 81 | +Performs the indexing (`container[index]`) operation. |
| 82 | + |
| 83 | +### `impl<'a, K, V> IntoIterator for &'a Map<K, V>` |
| 84 | + |
| 85 | +#### `type Item = (&'aK, &'aV)` |
| 86 | + |
| 87 | +The type of the elements being iterated over. |
| 88 | + |
| 89 | +#### `type IntoIter = Entries<'a, K, V>` |
| 90 | + |
| 91 | +Which kind of iterator are we turning this into? |
| 92 | + |
| 93 | +#### `pub fn into_iter(self) -> Entries<'a, K, V>ⓘ Notable traits for Entries<'a, K, V> impl<'a, K, V> Iterator for Entries<'a, K, V>type Item = (&'aK, &'aV);` |
| 94 | + |
| 95 | +Creates an iterator from a value. [Read more](https://doc.rust-lang.org/nightly/core/iter/traits/collect/trait.IntoIterator.html#tymethod.into_iter) |
| 96 | + |
| 97 | +## Auto Trait Implementations |
| 98 | + |
| 99 | +### `impl<K, V> RefUnwindSafe for Map<K, V> where K: RefUnwindSafe, V: RefUnwindSafe,` |
| 100 | + |
| 101 | +### `impl<K, V> Send for Map<K, V> where K: Send + Sync, V: Send + Sync,` |
| 102 | + |
| 103 | +### `impl<K, V> Sync for Map<K, V> where K: Sync, V: Sync,` |
| 104 | + |
| 105 | +### `impl<K, V> Unpin for Map<K, V> where K: Unpin, V: Unpin,` |
| 106 | + |
| 107 | +### `impl<K, V> UnwindSafe for Map<K, V> where K: RefUnwindSafe + UnwindSafe, V: RefUnwindSafe + UnwindSafe,` |
| 108 | + |
| 109 | +## Blanket Implementations |
| 110 | + |
| 111 | +### `impl<T> Any for T where T: 'static + ?Sized,` |
| 112 | + |
| 113 | +#### `pub fn type_id(&self) -> TypeId` |
| 114 | + |
| 115 | +Gets the `TypeId` of `self`. [Read more](https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id) |
| 116 | + |
| 117 | +### `impl<T> Borrow<T> for T where T: ?Sized,` |
| 118 | + |
| 119 | +#### `pub fn borrow(&self) -> &T` |
| 120 | + |
| 121 | +Immutably borrows from an owned value. [Read more](https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow) |
| 122 | + |
| 123 | +### `impl<T> BorrowMut<T> for T where T: ?Sized,` |
| 124 | + |
| 125 | +#### `pub fn borrow_mut(&mut self) -> &mutT` |
| 126 | + |
| 127 | +Mutably borrows from an owned value. [Read more](https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut) |
| 128 | + |
| 129 | +### `impl<T> From<T> for T` |
| 130 | + |
| 131 | +#### `pub fn from(t: T) -> T` |
| 132 | + |
| 133 | +Performs the conversion. |
| 134 | + |
| 135 | +### `impl<T> Instrument for T` |
| 136 | + |
| 137 | +#### `pub fn instrument(self, span: Span) -> Instrumented<Self>` |
| 138 | + |
| 139 | +Instruments this type with the provided `Span`, returning an `Instrumented` wrapper. [Read more](https://docs.rs/tracing/0.1.25/tracing/instrument/trait.Instrument.html#method.instrument) |
| 140 | + |
| 141 | +#### `pub fn in_current_span(self) -> Instrumented<Self>` |
| 142 | + |
| 143 | +Instruments this type with the [current](/docs/api/rust/tauri/../struct.Span.html#method.current) `Span`, returning an `Instrumented` wrapper. [Read more](https://docs.rs/tracing/0.1.25/tracing/instrument/trait.Instrument.html#method.in_current_span) |
| 144 | + |
| 145 | +### `impl<T, U> Into<U> for T where U: From<T>,` |
| 146 | + |
| 147 | +#### `pub fn into(self) -> U` |
| 148 | + |
| 149 | +Performs the conversion. |
| 150 | + |
| 151 | +### `impl<T> Pointable for T` |
| 152 | + |
| 153 | +#### `pub const ALIGN: usize` |
| 154 | + |
| 155 | +The alignment of pointer. |
| 156 | + |
| 157 | +#### `type Init = T` |
| 158 | + |
| 159 | +The type for initializers. |
| 160 | + |
| 161 | +#### `pub unsafe fn init(init: <T as Pointable>::Init) -> usize` |
| 162 | + |
| 163 | +Initializes a with the given initializer. [Read more](/docs/api/rust/tauri/about:blank#tymethod.init) |
| 164 | + |
| 165 | +#### `pub unsafe fn deref<'a>(ptr: usize) -> &'aT` |
| 166 | + |
| 167 | +Dereferences the given pointer. [Read more](/docs/api/rust/tauri/about:blank#tymethod.deref) |
| 168 | + |
| 169 | +#### `pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mutT` |
| 170 | + |
| 171 | +Mutably dereferences the given pointer. [Read more](/docs/api/rust/tauri/about:blank#tymethod.deref_mut) |
| 172 | + |
| 173 | +#### `pub unsafe fn drop(ptr: usize)` |
| 174 | + |
| 175 | +Drops the object pointed to by the given pointer. [Read more](/docs/api/rust/tauri/about:blank#tymethod.drop) |
| 176 | + |
| 177 | +### `impl<T, U> TryFrom<U> for T where U: Into<T>,` |
| 178 | + |
| 179 | +#### `type Error = Infallible` |
| 180 | + |
| 181 | +The type returned in the event of a conversion error. |
| 182 | + |
| 183 | +#### `pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>` |
| 184 | + |
| 185 | +Performs the conversion. |
| 186 | + |
| 187 | +### `impl<T, U> TryInto<U> for T where U: TryFrom<T>,` |
| 188 | + |
| 189 | +#### `type Error = <U as TryFrom<T>>::Error` |
| 190 | + |
| 191 | +The type returned in the event of a conversion error. |
| 192 | + |
| 193 | +#### `pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>` |
| 194 | + |
| 195 | +Performs the conversion. |
| 196 | + |
| 197 | +### `impl<V, T> VZip<V> for T where V: MultiLane<T>,` |
| 198 | + |
| 199 | +#### `pub fn vzip(self) -> V` |
0 commit comments