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: decimal.rs
    path of file: ./repos/cube/rust/cubestore/cubestore/src/util
    
    the code of the file until where you have to start completion: use bigdecimal::BigDecimal;
use deepsize::DeepSizeOf;
use num::BigInt;
use serde::{Deserialize, Deserializer, Serialize, Serializer};

#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, DeepSizeOf)]
#[repr(transparent)]
/// This it not a general-purpose decimal implementation. We use it inside [TableValue] to cement
/// data format of decimals in CubeStore.
pub struct Decimal {
    // Users see only i64, we keep i128 so serialization does not change when we switch to i128.
    raw_value: i
    
    pub fn to_string(&self, scale: u8) -> String {
        let big_decimal = BigDecimal::new(BigInt::from(self.raw_value), scale as i64);
        let mut res = big_decimal.to_string();
        if res.contains(".") {
            let mut truncate_len = res.len();
            for (i, c) in res.char_indices().rev() {
                if c == '0' {
                    truncate_len = i;
                } else if c == '.' {
                    truncate_len = i;
                    break;
                } else {
                    break;
                }
            }
            res.truncate(truncate_len);
        }
        res
    }