pub fn register_worker(
    conn: &PgConnection,
    w_name: String,
    w_id: String,
    pos: Position,
    vel: Velocity,
    dest: &Option<Position>,
    sr_address: Option<String>,
    lr_address: Option<String>,
    logger: &Logger,
) -> Result<i32, MeshSimError> {
    //Insert new worker
    let wr = insert_worker(conn, w_name, w_id, sr_address, lr_address, logger)?;

    //Add its position
    let _rows = update_worker_position(conn, pos, wr.id, logger)?;

    //Add its velocity
    let _rows = update_worker_vel(conn, vel, wr.id, logger)?;
    //Optionally: add it's destination
    if let Some(d) = dest {
        let _rows = update_worker_target(conn, *d, wr.id, logger)?;
    }

    Ok(wr.id)
}
/// Registers a newly created worker into the mobility system
Registers a newly created worker into the mobility system
Registers a newly created worker into the mobility system
pub fn register_worker(
    conn: &PgConnection,
    w_name: String,
    w_id: String,
    pos: Position,
    vel: Velocity,
    dest: &Option<Position>,
    sr_address: Option<String>,
    lr_address: Option<String>,
    logger: &Logger,
) -> Result<i32, MeshSimError> {
    //Insert new worker
    let wr = insert_worker(conn, w_name, w_id, sr_address, lr_address, logger)?;
    //Add its position
    let _rows = update_worker_position(conn, pos, wr.id, logger)?;
    //Add its velocity
    let _rows = update_worker_vel(conn, vel, wr.id, logger)?;
    //Optionally: add it's destination
    if let Some(d) = dest {
        let _rows = update_worker_target(conn, *d, wr.id, logger)?;
    }
    Ok(wr.id)
}
pub fn register_worker ( conn : & PgConnection , w_name : String , w_id : String , pos : Position , vel : Velocity , dest : & Option < Position > , sr_address : Option < String > , lr_address : Option < String > , logger : & Logger , ) -> Result < i32 , MeshSimError > { //Insert new worker let wr = insert_worker ( conn , w_name , w_id , sr_address , lr_address , logger ) ? ; //Add its position let _rows = update_worker_position ( conn , pos , wr . id , logger ) ? ; //Add its velocity let _rows = update_worker_vel ( conn , vel , wr . id , logger ) ? ; //Optionally: add it's destination if let Some ( d ) = dest { let _rows = update_worker_target ( conn , * d , wr . id , logger ) ? ; } Ok ( wr . id ) }
Registers a newly created worker into the mobility system
Registers a newly created worker into the mobility system
conn
&PgConnection
w_name
String
w_id
String
pos
Position
vel
Velocity
dest
&Option<Position>
sr_address
Option<String>
lr_address
Option<String>
logger
&Logger