You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here are some suggestions to improve the API for logical streams:
/// Rename from LogicalStreamTypepubenumLogicalType{Null,Bits(Positive),Group(Group),Union(Union),Stream(Stream),}implLogicalType{/// Returns an iterator over resulting split items. pubfnsplit(&self) -> Split{ ...}/// Returns an iterator over the physical streams resulting from splitting /// and mapping the element streams to physical streams.pubfnphysical(&self) -> PhysicalSplit{ ...}}/// An iterator over split items from a LogicalType.pubstructSplit(indexmap::set::IntoIter<SplitItem>);implIteratorforSplit{typeItem = SplitItem;}implDoubleEndedIteratorforSplit{ ... }implExactSizeIteratorforSplit{ ... }/// An iterator over physical split items from a LogicalType.pubstructPhysicalSplit(indexmap::set::IntoIter<SplitItem>);implIteratorforPhysicalSplit{typeItem = PhysicalSplitItem;}implDoubleEndedIteratorforPhysicalSplit{ ... }implExactSizeIteratorforPhysicalSplit{ ... }/// An element stream with a path name and LogicalType. Contains no nested /// streams.pubstructElementStream{path_name:PathName,logical_type:LogicalType,}implElementStream{/// Returns the LogicalType of this element. Contains no nested streams.pubfnlogical_type(&self) -> &LogicalType{&self.logical_type}/// Return all fields in this element streampubfnfields(&self) -> Fields{ ...}}implFrom<ElementStream>forPhysicalStream{ ... }pubstructSignals(LogicalType);implSignals{/// Returns the LogicalType of this element.pubfnlogical_type(&self) -> &LogicalType{&self.0}/// Returns all fields in these async signals.pubfnfields(&self) -> Fields{ ...}}/// A split item is either an async signal (outside streamspace) or an element/// stream (no nested streams).pubenumSplitItem{Signals(Signals),Stream(ElementStream),}/// A split item is either an async signal (outside streamspace) or a physical/// stream.pubenumPhysicalSplitItem{Signals(Signal),Stream(PhysicalStream),}
For the uses case of @ahadnagy this would result in something like this:
let haystack:LogicalType = ...;let needle:&[Name] = ...;let search:Option<SplitItem> = haystack
.split().find(|split_item|
match split_item {SplitItem::Signals(signals) => signals.fields(),SplitItem::Stream(element_stream) => element_stream.fields(),}.keys().windows(needle.len()).any(|name| name == filter));
Given that we modify the Fields::keys method to return &[Name] instead of &PathName.
This also solves #27. We could also use a marker trait to distinguish between nested and unnested LogicalTypes.
The text was updated successfully, but these errors were encountered:
Here are some suggestions to improve the API for logical streams:
For the uses case of @ahadnagy this would result in something like this:
Given that we modify the
Fields::keys
method to return&[Name]
instead of&PathName
.This also solves #27. We could also use a marker trait to distinguish between nested and unnested
LogicalType
s.The text was updated successfully, but these errors were encountered: