MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/splashsurf / parse

Method parse

splashsurf_lib/src/io/bgeo_format.rs:693–729  ·  view source on GitHub ↗
(
            &mut self,
            input: &'a [u8],
        )

Source from the content-addressed store, hash-verified

691 }
692
693 fn parse<'a>(
694 &mut self,
695 input: &'a [u8],
696 ) -> IResult<&'a [u8], (), BgeoParserError<&'a [u8]>> {
697 match self.attrib.attr_type {
698 BgeoAttributeType::Int => {
699 let storage = self.storage.as_int_mut();
700 map_res(number::be_i32, |val| {
701 storage.push(val);
702 Ok(())
703 })
704 .parse(input)
705 }
706 BgeoAttributeType::Float => {
707 let storage = self.storage.as_float_mut();
708 map_res(number::be_f32, |val| {
709 storage.push(val);
710 Ok(())
711 })
712 .parse(input)
713 }
714 BgeoAttributeType::Vector => {
715 let storage = self.storage.as_vec_mut();
716 let size = self.attrib.size;
717 fold(
718 size,
719 number::be_f32,
720 || (),
721 |_, val| {
722 storage.push(val);
723 },
724 )
725 .parse(input)
726 }
727 _ => panic!("Unsupported attribute type"),
728 }
729 }
730 }
731}
732

Callers 9

load_bgeo_fileFunction · 0.80
bgeo_parserFunction · 0.80
parse_magic_bytesFunction · 0.80
parse_new_magic_bytesFunction · 0.80
parse_header_magicFunction · 0.80
parse_attr_defFunction · 0.80
parse_pointsFunction · 0.80
bgeo_errorFunction · 0.80

Calls 3

as_int_mutMethod · 0.80
as_float_mutMethod · 0.80
as_vec_mutMethod · 0.80

Tested by 1