INNER CODE UNIT · Rust

validate

xuzhougeng/wisp-science · crates/wisp-acp/src/lib.rs:65

    fn validate(&self) -> Result<(), AcpError> {
        if self.id.trim().is_empty() {
            return Err(AcpError::InvalidProfile("agent id is empty"));
        }
        if self.label.trim().is_empty() {
            return Err(AcpError::InvalidProfile("agent label is empty"));
        }
        if self.command.as_os_str().is_empty() {
            return Err(AcpError::InvalidProfile("agent command is empty"));
        }
        if self.env.keys().any(|key| key.is_empty()) {
            return Err(AcpError::InvalidProfile("environment key is empty"));
        }
        Ok(())
    }
}

#[derive(Debug, Clone, PartialEq, Eq)]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…