pub fn merge_resumed(unfinished: Syscall, resumed: Syscall) -> Result<Syscall> {
            if unfinished.pid != resumed.pid {
                return Err("pid mismatch".into());
            }
            let prefix = if let Call::Unfinished(prefix) = unfinished.call {
                prefix
            } else {
                return Err("bad call in unfinished".into());
            };
            let suffix = if let Call::Resumed(suffix) = resumed.call {
                suffix
            } else {
                return Err("bad call in resumed".into());
            };

            let line = prefix + &suffix;
            let (remainder, mut value) = nom!(merge_parser(line.as_bytes()))?;
            if remainder.len() != 0 {
                return Err(ErrorKind::NomError(
                    format!(
                        "unused input {:?} from {:?}",
                        std::str::from_utf8(remainder),
                        &line
                    )
                    .into(),
                )
                .into());
            }
            // Take the start and pid from the original call -
            value.pid = unfinished.pid;
            value.start = unfinished.start;
            value.set_stop();
            Ok(value)
        }
/// Merge an unfinished and a resumed syscall.
/// The syscalls are needed to get the timing data, but the
/// knowledge of type from the union is embedded, so it can error :/.
/// If you have ideas on making this nicer let me know.
/// TODO? move into the higher layer module?
Merge an unfinished and a resumed syscall.
The syscalls are needed to get the timing data, but the
knowledge of type from the union is embedded, so it can error :/.
If you have ideas on making this nicer let me know.
TODO.
Merge an unfinished and a resumed syscall . The syscalls are needed to get the timing data but the knowledge of type from the union is embedded so it can error : / . If you have ideas on making this nicer let me know . TODO .
pub fn merge_resumed(unfinished: Syscall, resumed: Syscall) -> Result<Syscall> {
            if unfinished.pid != resumed.pid {
                return Err("pid mismatch".into());
            }
            let prefix = if let Call::Unfinished(prefix) = unfinished.call {
                prefix
            } else {
                return Err("bad call in unfinished".into());
            };
            let suffix = if let Call::Resumed(suffix) = resumed.call {
                suffix
            } else {
                return Err("bad call in resumed".into());
            };
            let line = prefix + &suffix;
            let (remainder, mut value) = nom!(merge_parser(line.as_bytes()))?;
            if remainder.len() != 0 {
                return Err(ErrorKind::NomError(
                    format!(
                        "unused input {:?} from {:?}",
                        std::str::from_utf8(remainder),
                        &line
                    )
                    .into(),
                )
                .into());
            }
            // Take the start and pid from the original call -
            value.pid = unfinished.pid;
            value.start = unfinished.start;
            value.set_stop();
            Ok(value)
        }
pub fn merge_resumed ( unfinished : Syscall , resumed : Syscall ) -> Result < Syscall > { if unfinished . pid != resumed . pid { return Err ( " " . into ( ) ) ; } let prefix = if let Call :: Unfinished ( prefix ) = unfinished . call { prefix } else { return Err ( " " . into ( ) ) ; } ; let suffix = if let Call :: Resumed ( suffix ) = resumed . call { suffix } else { return Err ( " " . into ( ) ) ; } ; let line = prefix + & suffix ; let ( remainder , mut value ) = nom ! ( merge_parser ( line as_bytes ( ) ) ) ? ; if remainder . len ( ) != 0 { return Err ( ErrorKind :: NomError ( format ! ( " " std str from_utf8 ( remainder ) line ) . into ( ) , ) . into ( ) ) ; } // Take the start and pid from the original call - value . pid = unfinished . pid ; value . start = unfinished . start ; value . set_stop ( ) ; Ok ( value ) }
Merge an unfinished and a resumed syscall.
Merge an unfinished and a resumed syscall .
unfinished
Syscall
resumed
Syscall
unfinished
Syscall
resumed
Syscall