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: focus_state.rs
    path of file: ./repos/orbtk/orbtk_core/src/properties/widget
    
    the code of the file until where you have to start completion: use crate::{theming::Selector, widget_base::Context};

use dces::prelude::Entity;

/// Contains the state information of the current focused element.
///
/// Provides methods to request and remove focus.
#[derive(Debug, Default, Clone, Eq, PartialEq)]
pub struct FocusState {
    focused_entity: Option<Entity>
    
    pub fn request_focus(&mut self, entity: impl Into<Entity>, ctx: &mut Context) {
        let entity = entity.into();

        if (self.focused_entity.is_some() && self.focused_entity.unwrap() == entity)
            || !*ctx.get_widget(entity).get::<bool>("enabled")
        {
            return;
        }

        if let Some(old_focused_element) = self.focused_entity {
            let mut old_focused_element = ctx.get_widget(old_focused_element);

            old_focused_element.set("focused", false);
            old_focused_element
                .get_mut::<Selector>("selector")
                .remove_all_similar_states("focused");
            old_focused_element.update(false);
        }

        self.focused_entity = Some(entity);

        if ctx.get_widget(entity).has::<bool>("focused") {
            let mut focused_element = ctx.get_widget(entity);

            focused_element.set("focused", true);
            focused_element
                .get_mut::<Selector>("selector")
                .push_state("focused");
            focused_element.update(false);
        }
    }