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: context.rs
    path of file: ./repos/plotters/plotters/src/chart
    
    the code of the file until where you have to start completion: use std::borrow::Borrow;

use plotters_backend::{BackendCoord, DrawingBackend};

use crate::chart::{SeriesAnno, SeriesLabelStyle};
use crate::coord::{CoordTranslate, ReverseCoordTranslate, Shift};
use crate::drawing::{DrawingArea, DrawingAreaErrorKind};
use crate::element::{CoordMapper, Drawable, PointCollection};

pub(super) mod cartesian2d;
pub(super) mod cartesian3d;

pub(super) use cartesian3d::Coord3D;

/**
The context of the chart. This is the core object of Plotters.

Any plot/chart is abstracted as this type, and any data series can be placed to the chart context.

- To draw a series on a chart context, use [`ChartContext::draw_series()`].
- To draw a single element on the chart, you may want to use [`ChartContext::plotting_area()`].

See [`crate::series::LineSeries`] and [`ChartContext::configure_series_labels()`] for more information and examples
*/
pub struct ChartContext<'a, DB: DrawingBackend, CT: CoordTranslate> {
    pub(crate) x_label_area: [Option<DrawingArea<DB, Shift>>; 2],
    pub(crate) y_label_area: [Option<DrawingArea<DB, Shift>>; 2],
    pub(crate) drawing_area: DrawingArea<DB, CT>,
    pub(crate) series_anno: Vec<SeriesAnno<'a, DB>>,
    pub(crate) drawing_area_pos: (i32, i32),
}

impl<'a, DB: DrawingBackend, CT: ReverseCoordTranslate> ChartContext<'a, DB, CT> {
    /// Convert the chart context into an closure that can be used for
    
    fn test_chart_context() {
        let drawing_area = create_mocked_drawing_area(200, 200, |_| {});

        drawing_area.fill(&WHITE).expect("Fill");

        let mut chart = ChartBuilder::on(&drawing_area)
            .caption("Test Title", ("serif", 10))
            .x_label_area_size(20)
            .y_label_area_size(20)
            .set_label_area_size(LabelAreaPosition::Top, 20)
            .set_label_area_size(LabelAreaPosition::Right, 20)
            .build_cartesian_2d(0..10, 0..10)
            .expect("Create chart")
            .set_secondary_coord(0.0..1.0, 0.0..1.0);

        chart
            .configure_mesh()
            .x_desc("X")
            .y_desc("Y")
            .draw()
            .expect("Draw mesh");
        chart
            .configure_secondary_axes()
            .x_desc("X")
            .y_desc("Y")
            .draw()
            .expect("Draw Secondary axes");

        // test that chart states work correctly with dual coord charts
        let cs = chart.into_chart_state();
        let mut chart = cs.clone().restore(&drawing_area);

        chart
            .draw_series(std::iter::once(Circle::new((5, 5), 5, RED)))
            .expect("Drawing error");
        chart
            .draw_secondary_series(std::iter::once(Circle::new((0.3, 0.8), 5, GREEN)))
            .expect("Drawing error")
            .label("Test label")
            .legend(|(x, y)| Rectangle::new([(x - 10, y - 5), (x, y + 5)], GREEN));

        chart
            .configure_series_labels()
            .position(SeriesLabelPosition::UpperMiddle)
            .draw()
            .expect("Drawing error");
    }