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: adsr.rs
    path of file: ./repos/glicol/rs/synth/src/node/envelope
    
    the code of the file until where you have to start completion: use crate::{impl_to_boxed_nodedata, BoxedNodeSend, Buffer, Input, Message, Node, NodeData};
use hashbrown::HashMap;
#[derive(Debug, Clone)]
pub struct Adsr {
    attack: f32,
    decay: f32,
    sustain: f32,
    release: f32,
    pos: usize, // the pos since the attack is triggered
    gate: f32,
    lastx: f32,
    lasty: f32,
    step: usize, // the clock since the node created
    state_change_y: f32,
    sr: usize,
    phase: u8,
    input_order: Vec<usize>,
}

impl Adsr {
    pub fn new() -> Self {
        Self {
            attack: 0.01,
    
    
    fn send_msg(&mut self, info: Message) {
        match info {
            Message::SetToNumber(pos, value) => match pos {
                0 => self.attack = value,
                1 => self.decay = value,
                2 => self.sustain = value,
                3 => self.release = value,
                _ => {}
            },
            Message::Index(i) => self.input_order.push(i),
            Message::IndexOrder(pos, index) => self.input_order.insert(pos, index),
            Message::ResetOrder => {
                self.input_order.clear();
            }
            _ => {}
        }
    }