Change insert_all to accept all kinds of into_iterator implementations

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/36/head
trivernis 3 years ago
parent 5c77d3cd28
commit b57dea5bb4
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -1,6 +1,6 @@
[package] [package]
name = "bromine" name = "bromine"
version = "0.18.2" version = "0.18.3"
authors = ["trivernis <trivernis@protonmail.com>"] authors = ["trivernis <trivernis@protonmail.com>"]
edition = "2018" edition = "2018"
readme = "README.md" readme = "README.md"
@ -32,6 +32,7 @@ bincode = { version = "1.3.3", optional = true }
serde_json = { version = "1.0.79", optional = true } serde_json = { version = "1.0.79", optional = true }
[dependencies.typemap_rev] [dependencies.typemap_rev]
version = "0.1.5"
git = "https://github.com/Trivernis/typemap_rev" git = "https://github.com/Trivernis/typemap_rev"
rev = "750c67bffe8024d2a47725daa473f068ad653fc4" rev = "750c67bffe8024d2a47725daa473f068ad653fc4"

@ -12,6 +12,7 @@ use crate::namespaces::namespace::Namespace;
#[cfg(feature = "serialize")] #[cfg(feature = "serialize")]
use crate::payload::DynamicSerializer; use crate::payload::DynamicSerializer;
use crate::protocol::AsyncStreamProtocolListener; use crate::protocol::AsyncStreamProtocolListener;
use std::any::{Any, TypeId};
use std::collections::HashMap; use std::collections::HashMap;
use std::future::Future; use std::future::Future;
use std::pin::Pin; use std::pin::Pin;
@ -100,7 +101,10 @@ where
} }
/// Adds all the data from the other given type map /// Adds all the data from the other given type map
pub fn insert_all(mut self, value: TypeMap) -> Self { pub fn insert_all<I: IntoIterator<Item = (TypeId, Box<dyn Any + Send + Sync>)>>(
mut self,
value: I,
) -> Self {
self.data.extend(value); self.data.extend(value);
self self

Loading…
Cancel
Save