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: triggers.rs
    path of file: ./repos/rustrogueliketutorial/chapter-74-darkcity/src/effects
    
    the code of the file until where you have to start completion: use super::*;
use crate::components::*;
use crate::RunState;

pub fn item_trigger(creator : Option<Entity>, item: Entity
    
pub fn item_trigger(creator : Option<Entity>, item: Entity, targets : &Targets, ecs: &mut World) {
    // Check charges
    if let Some(c) = ecs.write_storage::<Consumable>().get_mut(item) {
        if c.charges < 1 {
            // Cancel
            crate::gamelog::Logger::new()
                .item_name(&ecs.read_storage::<Name>().get(item).unwrap().name)
                .append("is out of charges!")
                .log();
            return;
        } else {
            c.charges -= 1;
        }
    }

    // Use the item via the generic system
    let did_something = event_trigger(creator, item, targets, ecs);

    // If it was a consumable, then it gets deleted
    if did_something {
        if let Some(c) = ecs.read_storage::<Consumable>().get(item) {
            rltk::console::log(format!("{}", c.max_charges));
            if c.max_charges < 2 {
                ecs.entities().delete(item).expect("Delete Failed");
            }
        }
    }
}