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: set.rs
    path of file: ./repos/bonsaidb/crates/bonsaidb-core/src/keyvalue/implementation
    
    the code of the file until where you have to start completion: use std::ops::Add;
use std::time::{Duration, SystemTime};

use futures::{Future, FutureExt};
use serde::{Deserialize, Serialize};

use super::{
    BuilderState, Command, KeyCheck, KeyOperation, KeyStatus, KeyValue, Output, PendingValue,
    Timestamp,
};
use crate::keyvalue::{AsyncKeyValue, SetCommand, Value};
use crate::Error;

/// Builder for a [`Command::Set`] key-value operation.
#[must_use = "the key-value operation is not performed until execute() is called"]
pub struct Builder<'a, KeyValue, V> {
    kv: &'a KeyValue,
    namespace: Option<String>,
    key: String,
    value: PendingValue<'a, V>,
    expiration: Option<Timestamp>,
    keep_existing_expiration: bool,
    check: Option<KeyCheck>,
}

impl<'a, K, V> Builder<'a, K, V>
where
    K: KeyValue,
    V: Serialize + Send + Sync,
{
    pub(crate) const fn new(
        kv: &'a K,
        namespace: Option<String>,
    
    pub async fn returning_previous(self) -> Result<Option<Value>, Error> {
        if let BuilderState::Pending(Some(builder)) = self.state {
            let Options {
                kv,
                namespace,
                key,
                value,
                expiration,
                keep_existing_expiration,
                check,
            } = builder;

            let result = kv
                .execute_key_operation(KeyOperation {
                    namespace,
                    key,
                    command: Command::Set(SetCommand {
                        value: value.prepare()?,
                        expiration,
                        keep_existing_expiration,
                        check,
                        return_previous_value: true,
                    }),
                })
                .await?;
            match result {
                Output::Value(value) => Ok(value),
                Output::Status(KeyStatus::NotChanged) => Ok(None),
                Output::Status(_) => unreachable!("Unexpected output from Set"),
            }
        } else {
            panic!("Using future after it's been executed")
        }
    }