pub fn build(self) -> Result<Unit, BuildError> {
        let inner = match Rc::try_unwrap(self.inner) {
            Ok(inner) => inner,
            Err(..) => return Err(BuildError::NotExclusivelyHeld),
        };

        let mut inner = inner.into_inner();

        if let Some(debug) = &mut inner.debug {
            debug.functions_rev = inner.functions_rev;
        }

        for (from, to) in inner.reexports {
            let info = match inner.functions.get(&to) {
                Some(info) => *info,
                None => return Err(BuildError::MissingFunctionHash { hash: to }),
            };

            if inner.functions.insert(from, info).is_some() {
                return Err(BuildError::FunctionConflictHash { hash: from });
            }
        }

        Ok(Unit::new(
            inner.instructions,
            inner.functions,
            inner.static_strings,
            inner.static_bytes,
            inner.static_object_keys,
            inner.rtti,
            inner.variant_rtti,
            inner.debug,
            inner.constants,
        ))
    }
/// Convert into a runtime unit, shedding our build metadata in the process.
///
/// Returns `None` if the builder is still in use.
Convert into a runtime unit, shedding our build metadata in the process.
Returns `None` if the builder is still in use.
Convert into a runtime unit shedding our build metadata in the process . Returns ` None ` if the builder is still in use .
pub fn build(self) -> Result<Unit, BuildError> {
        let inner = match Rc::try_unwrap(self.inner) {
            Ok(inner) => inner,
            Err(..) => return Err(BuildError::NotExclusivelyHeld),
        };
        let mut inner = inner.into_inner();
        if let Some(debug) = &mut inner.debug {
            debug.functions_rev = inner.functions_rev;
        }
        for (from, to) in inner.reexports {
            let info = match inner.functions.get(&to) {
                Some(info) => *info,
                None => return Err(BuildError::MissingFunctionHash { hash: to }),
            };
            if inner.functions.insert(from, info).is_some() {
                return Err(BuildError::FunctionConflictHash { hash: from });
            }
        }
        Ok(Unit::new(
            inner.instructions,
            inner.functions,
            inner.static_strings,
            inner.static_bytes,
            inner.static_object_keys,
            inner.rtti,
            inner.variant_rtti,
            inner.debug,
            inner.constants,
        ))
    }
pub fn build ( self ) -> Result < Unit , BuildError > { let inner = match Rc :: try_unwrap ( self . inner ) { Ok ( inner ) => inner , Err ( .. ) => return Err ( BuildError :: NotExclusivelyHeld ) , } ; let mut inner = inner . into_inner ( ) ; if let Some ( debug ) = & mut inner . debug { debug . functions_rev = inner . functions_rev ; } for ( from , to ) in inner . reexports { let info = match inner . functions . get ( & to ) { Some ( info ) => * info , None => return Err ( BuildError :: MissingFunctionHash { hash : to } ) , } ; if inner . functions . insert ( from , info ) . is_some ( ) { return Err ( BuildError :: FunctionConflictHash { hash : from } ) ; } } Ok ( Unit :: new ( inner . instructions , inner . functions , inner . static_strings , inner . static_bytes , inner . static_object_keys , inner . rtti , inner . variant_rtti , inner . debug , inner . constants , ) ) }
Convert into a runtime unit, shedding our build metadata in the process.
Convert into a runtime unit shedding our build metadata in the process .
self
self