brane_let/exec_nop.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
// EXEC NOP.rs
// by Lut99
//
// Created:
// 14 Feb 2022, 16:37:17
// Last edited:
// 22 May 2023, 10:24:20
// Auto updated?
// Yes
//
// Description:
//! "Executes" the no-operation command in brane-let. Does nothing,
//! except
//
use brane_exe::FullValue;
use log::{debug, info};
// use crate::callback::Callback;
use crate::common::PackageResult;
use crate::errors::LetError;
/***** ENTRYPOINT *****/
/// Handles athe No-Op, and thus does no meaningful work (except for sending as many callbacks as needed).
///
/// **Arguments**
/// * `callback`: The callback object we use to keep in touch with the driver.
///
/// **Returns**
/// The return state of the package call on success, or a LetError otherwise.
pub async fn handle(// callback: &mut Option<&mut Callback>,
) -> Result<PackageResult, LetError> {
debug!("Executing No-Operation (nop) without arguments");
// Send the 'Initialize' callback
// if let Some(callback) = callback {
// if let Err(err) = callback.initialized().await { warn!("Could not update driver on Initialized: {}", err); }
// }
info!("Reached target 'Initialized'");
// Send the 'Started' callback
// if let Some(callback) = callback {
// if let Err(err) = callback.started().await { warn!("Could not update driver on Started: {}", err); }
// }
info!("Reached target 'Started'");
// Send the 'Completed' callback
// if let Some(callback) = callback {
// if let Err(err) = callback.completed().await { warn!("Could not update driver on Completed: {}", err); }
// }
info!("Reached target 'Completed'");
// Done, return the empty result
Ok(PackageResult::Finished { result: FullValue::Void })
}