8000 Improve output subroute calculation · Issue #1189 · andrewdavidmackenzie/flow · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Improve output subroute calculation #1189
Open
@andrewdavidmackenzie

Description

@andrewdavidmackenzie

I suspect this is wrong now....

/// Connect the `from_io` to the `to_io` if they are compatible
pub fn connect(&mut self, from_io: IO, to_io: IO, level: usize) -> Result<()> {
    // are we selecting from a sub-route of an IO, such as an array index or element of output object?
    let from_io_subroute = self.from.strip_prefix(from_io.route() as &str).unwrap_or("");
    if Self::compatible_types(from_io.datatypes(), to_io.datatypes(), &Route::from(from_io_subroute)) {
        debug!(
            "Connection built from '{}' to '{}'",
            from_io.route(),
            to_io.route()
        );
        self.from_io = from_io;
        self.to_io = to_io;
        self.level = level;
        return Ok(());
    }

    bail!("Incompatible source and destination:\nSource '{}' of type {:#?}\nDestination '{} of type {:#?}\nfrom_io_subroute = {}",
        from_io.route(), from_io.datatypes(),
        to_io.route(), to_io.datatypes(), from_io_subroute)
}

It might work when an array, but probably not when sub-selecting a part of an outputs structure

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0