pub fn with_combo<S: Into<String>>(mut self, source: S) -> Result<Self, ShaderError> {
        for shader in source.into().split("#type ") {
            if shader.trim().is_empty() {
                continue;
            }

            let end_of_type_header = match shader.find(|s| s == ' ' || s == '\n') {
                Some(index) => index,
                None => return Err(ShaderError::MissingTypeHeader),
            };
            let type_header = shader[0..end_of_type_header].trim();
            let source = &shader[end_of_type_header + 1..];

            match type_header {
                "vertex" => self.vertex = Some(source.to_string()),
                "fragment" => self.fragment = Some(source.to_string()),
                _ => return Err(ShaderError::InvalidTypeHeader(type_header.to_string())),
            }
        }
        Ok(self)
    }
/// Source contains multiple shaders marked with their `#type` tags.
Source contains multiple shaders marked with their `#type` tags.
Source contains multiple shaders marked with their ` #type ` tags .
pub fn with_combo<S: Into<String>>(mut self, source: S) -> Result<Self, ShaderError> {
        for shader in source.into().split("#type ") {
            if shader.trim().is_empty() {
                continue;
            }
            let end_of_type_header = match shader.find(|s| s == ' ' || s == '\n') {
                Some(index) => index,
                None => return Err(ShaderError::MissingTypeHeader),
            };
            let type_header = shader[0..end_of_type_header].trim();
            let source = &shader[end_of_type_header + 1..];
            match type_header {
                "vertex" => self.vertex = Some(source.to_string()),
                "fragment" => self.fragment = Some(source.to_string()),
                _ => return Err(ShaderError::InvalidTypeHeader(type_header.to_string())),
            }
        }
        Ok(self)
    }
pub fn with_combo < S : Into < String > > ( mut self , source : S ) -> Result < Self , ShaderError > { for shader in source . into ( ) . split ( " " ) { if shader . trim ( ) . is_empty ( ) { continue ; } let end_of_type_header = match shader . find ( | s | s == ' ' || s == '\n' ) { Some ( index ) => index , None => return Err ( ShaderError :: MissingTypeHeader ) , } ; let type_header = shader [ 0 .. end_of_type_header ] . trim ( ) ; let source = & shader [ end_of_type_header + 1 .. ] ; match type_header { " " => self . vertex = Some ( source . to_string ( ) ) , " " => self . fragment = Some ( source . to_string ( ) ) , _ => return Err ( ShaderError :: InvalidTypeHeader ( type_header . to_string ( ) ) ) , } } Ok ( self ) }
Source contains multiple shaders marked with their `#type` tags.
Source contains multiple shaders marked with their ` #type ` tags .
mut self
source
S
mut self
source
S