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: ffi.rs
    path of file: ./repos/databend/src/common/arrow/src/arrow/array/dictionary
    
    the code of the file until where you have to start completion: // Copyright 2020-2022 Jorge C. Leit√£o
// Copyright 2021 Datafuse Labs
//
// Licensed under the Apache License, Version 2.0 (the "License")
    
    unsafe fn try_from_ffi(array: A) -> Result<Self, Error> {
        // keys: similar to PrimitiveArray, but the datatype is the inner one
        let validity = unsafe { array.validity() }?;
        let values = unsafe { array.buffer::<K>(1) }?;

        let data_type = array.data_type().clone();

        let keys = PrimitiveArray::<K>::try_new(K::PRIMITIVE.into(), values, validity)?;
        let values = array
            .dictionary()?
            .ok_or_else(|| Error::oos("Dictionary Array must contain a dictionary in ffi"))?;
        let values = ffi::try_from(values)?;

        // the assumption of this trait
        DictionaryArray::<K>::try_new_unchecked(data_type, keys, values)
    }