You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: update.rs
    path of file: ./repos/mongo-rust-driver/src/operation
    
    the code of the file until where you have to start completion: #[cfg(test)]
mod test;

use serde::{Deserialize, Serialize};

use crate::{
    bson::{doc, rawdoc, Document, RawArrayBuf, RawBson, RawDocumentBuf},
    bson_util,
    cmap::{Command, RawCommandResponse, StreamDescription},
    error::{convert_bulk_errors, Result},
    operation::{OperationWithDefaults, Retryability, WriteResponseBody},
    options::{UpdateModifications, UpdateOptions, WriteConcern},
    results::UpdateResult,
    serde_util::to_raw_document_buf_with_options,
    Namespace,
};

#[derive(Clone, Debug)]
pub(crate) enum UpdateOrReplace<'a, T = ()> {
    UpdateModifications(UpdateModifications),
    Replacement(&'a T),
}

impl<'a, T: Serialize> UpdateOrReplace<'a, T> {
    pub(crate) fn to_raw_bson(&self, human_readable_serialization: bool) -> Result<RawBson> {
        match self {
            Self::UpdateModifications(update_modifications) => match update_modifications {
                UpdateModifications::Document(document) => {
                    Ok(RawDocumentBuf::from_document(document)?.into())
                }
                UpdateModifications::Pipeline(pipeline) => bson_util::to_raw_bson_array(pipeline),
            },
            Self::Replacement(replacement) => {
                let replacement_doc =
                    to_raw_document_buf_with_options(replacement, human_readable_serialization)?;
                bson_util::replacement_raw_document_check(&replacement_doc)?;
                Ok(replacement_doc.into())
            }
        }
    }
}

impl From<UpdateModifications> for UpdateOrReplace<'_> {
    fn from(upd
    
    fn build(&mut self, _description: &StreamDescription) -> Result<Command<Self::Command>> {
        let mut body = rawdoc! {
            Self::NAME: self.ns.coll.clone(),
        };

        let mut update = rawdoc! {
            "q": RawDocumentBuf::from_document(&self.filter)?,
            "u": self.update.to_raw_bson(self.human_readable_serialization)?,
        };

        if let Some(ref options) = self.options {
            if let Some(upsert) = options.upsert {
                update.append("upsert", upsert);
            }

            if let Some(ref array_filters) = options.array_filters {
                update.append("arrayFilters", bson_util::to_raw_bson_array(array_filters)?);
            }

            if let Some(ref hint) = options.hint {
                update.append("hint", hint.to_raw_bson()?);
            }

            if let Some(ref collation) = options.collation {
                update.append("collation", bson::to_raw_document_buf(&collation)?);
            }

            if let Some(bypass_doc_validation) = options.bypass_document_validation {
                body.append("bypassDocumentValidation", bypass_doc_validation);
            }

            if let Some(ref write_concern) = options.write_concern {
                if !write_concern.is_empty() {
                    body.append("writeConcern", bson::to_raw_document_buf(write_concern)?);
                }
            }

            if let Some(ref let_vars) = options.let_vars {
                body.append("let", bson::to_raw_document_buf(&let_vars)?);
            }

            if let Some(ref comment) = options.comment {
                body.append("comment", RawBson::try_from(comment.clone())?);
            }
        };

        if let Some(multi) = self.multi {
            update.append("multi", multi);
        }

        let mut updates = RawArrayBuf::new();
        updates.push(update);
        body.append("updates", updates);
        body.append("ordered", true); // command monitoring tests expect this (SPEC-1130)

        Ok(Command::new(
            Self::NAME.to_string(),
            self.ns.db.clone(),
            body,
        ))
    }