Skip to content

Commit

Permalink
fix: rename extend function to avoid std conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
ccbrown committed Dec 20, 2024
1 parent b59213b commit 6059ffb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/iocraft/src/element.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ use std::{
/// Used by the `element!` macro to extend a collection with elements.
#[doc(hidden)]
pub trait ExtendWithElements<T>: Sized {
fn extend<E: Extend<T>>(self, dest: &mut E);
fn extend_with_elements<E: Extend<T>>(self, dest: &mut E);
}

impl<'a, T, U> ExtendWithElements<T> for Element<'a, U>
where
U: ElementType + 'a,
T: From<Element<'a, U>>,
{
fn extend<E: Extend<T>>(self, dest: &mut E) {
fn extend_with_elements<E: Extend<T>>(self, dest: &mut E) {
dest.extend([self.into()]);
}
}

impl<'a> ExtendWithElements<AnyElement<'a>> for AnyElement<'a> {
fn extend<E: Extend<AnyElement<'a>>>(self, dest: &mut E) {
fn extend_with_elements<E: Extend<AnyElement<'a>>>(self, dest: &mut E) {
dest.extend([self]);
}
}
Expand All @@ -42,7 +42,7 @@ where
I: IntoIterator<Item = U>,
U: Into<T>,
{
fn extend<E: Extend<T>>(self, dest: &mut E) {
fn extend_with_elements<E: Extend<T>>(self, dest: &mut E) {
dest.extend(self.into_iter().map(|e| e.into()));
}
}
Expand All @@ -54,7 +54,7 @@ where
T: Extend<E>,
U: ExtendWithElements<E>,
{
elements.extend(dest);
elements.extend_with_elements(dest);
}

/// Used to identify an element within the scope of its parent. This is used to minimize the number
Expand Down

0 comments on commit 6059ffb

Please sign in to comment.