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: size_in_fields.rs
    path of file: ./repos/snarkVM/console/program/src/data/plaintext
    
    the code of the file until where you have to start completion: // Copyright (C) 2019-2023 Aleo Systems Inc.
// This file is part of the snarkVM library.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use thi
    
    fn size_in_fields(&self) -> Result<u16> {
        // Compute the number of bits.
        let num_bits = self.to_bits_le().len() + 1; // 1 extra bit for the terminus indicator.
        // Compute the ceiling division of the number of bits by the number of bits in a field element.
        let num_fields = (num_bits + Field::<N>::size_in_data_bits() - 1) / Field::<N>::size_in_data_bits();
        // Ensure the number of field elements does not exceed the maximum allowed size.
        match num_fields <= N::MAX_DATA_SIZE_IN_FIELDS as usize {
            // Return the number of field elements.
            true => Ok(u16::try_from(num_fields).or_halt_with::<N>("Plaintext exceeds u16::MAX field elements.")),
            false => bail!("Plaintext cannot exceed {} field elements.", N::MAX_DATA_SIZE_IN_FIELDS),
        }
    }