/// Write to a `lhs` that is volatile
Write to a `lhs` that is volatile
Write to a ` lhs ` that is volatile
pub fn volatile_write(&self, lhs: &P<Expr>, lhs_type: CQualTypeId, rhs: P<Expr>) -> Result<P<Expr>, String> {
        let addr_lhs = match lhs.node {
            ExprKind::Unary(ast::UnOp::Deref, ref e) => {
                if lhs_type.qualifiers.is_const {
                    let lhs_type = self.convert_type(lhs_type.ctype)?;
                    let ty = mk().mutbl().ptr_ty(lhs_type);
                    mk().cast_expr(e, ty)
                } else {
                    e.clone()
                }
            }
            _ => {
                let addr_lhs = mk().mutbl().addr_of_expr(lhs);
                let lhs_type = self.convert_type(lhs_type.ctype)?;
                let ty = mk().mutbl().ptr_ty(lhs_type);
                mk().cast_expr(addr_lhs, ty)
            },
        };
        Ok(mk().call_expr(mk().path_expr(vec!["", "std", "ptr", "write_volatile"]), vec![addr_lhs, rhs]))
    }
pub fn volatile_write ( & self , lhs : & P < Expr > , lhs_type : CQualTypeId , rhs : P < Expr > ) -> Result < P < Expr > , String > { let addr_lhs = match lhs . node { ExprKind :: Unary ( ast :: UnOp :: Deref , ref e ) => { if lhs_type . qualifiers . is_const { let lhs_type = self . convert_type ( lhs_type . ctype ) ? ; let ty = mk ( ) . mutbl ( ) . ptr_ty ( lhs_type ) ; mk ( ) . cast_expr ( e , ty ) } else { e . clone ( ) } } _ => { let addr_lhs = mk ( ) . mutbl ( ) . addr_of_expr ( lhs ) ; let lhs_type = self . convert_type ( lhs_type . ctype ) ? ; let ty = mk ( ) . mutbl ( ) . ptr_ty ( lhs_type ) ; mk ( ) . cast_expr ( addr_lhs , ty ) } , } ; Ok ( mk ( ) . call_expr ( mk ( ) . path_expr ( vec ! [ " " " " " " " " ] ) , vec ! [ addr_lhs rhs ] ) ) }
Write to a `lhs` that is volatile
Write to a ` lhs ` that is volatile
&self
lhs
&P<Expr>
lhs_type
CQualTypeId
rhs
P<Expr>