Skip to content

Commit 1563c13

Browse files
committed
fix: impl downcast for Sequence<T>
1 parent 2a9f66d commit 1563c13

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

src/value/impl_sequence.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ impl SequenceValueTypeMarker for DynSequenceValueType {
3030
crate::private_impl!();
3131
}
3232

33+
impl DowncastableTarget for DynSequenceValueType {
34+
fn can_downcast(dtype: &ValueType) -> bool {
35+
matches!(dtype, ValueType::Sequence { .. })
36+
}
37+
38+
crate::private_impl!();
39+
}
40+
3341
#[derive(Debug)]
3442
pub struct SequenceValueType<T: ValueTypeMarker + DowncastableTarget + Debug + ?Sized>(PhantomData<T>);
3543
impl<T: ValueTypeMarker + DowncastableTarget + Debug + ?Sized> ValueTypeMarker for SequenceValueType<T> {
@@ -43,6 +51,17 @@ impl<T: ValueTypeMarker + DowncastableTarget + Debug + ?Sized> SequenceValueType
4351
crate::private_impl!();
4452
}
4553

54+
impl<T: ValueTypeMarker + DowncastableTarget + Debug + ?Sized> DowncastableTarget for SequenceValueType<T> {
55+
fn can_downcast(dtype: &ValueType) -> bool {
56+
match dtype {
57+
ValueType::Sequence(ty) => T::can_downcast(ty),
58+
_ => false
59+
}
60+
}
61+
62+
crate::private_impl!();
63+
}
64+
4665
pub type DynSequence = Value<DynSequenceValueType>;
4766
pub type Sequence<T> = Value<SequenceValueType<T>>;
4867

0 commit comments

Comments
 (0)