contract_check_ensures

contract_check_ensures (후조건 검사)

후조건(post-condition) cond 가 충족되었는지 검사하는 내장 함수예요.

출처: Rust 공식 문서

본문

후조건 cond 가 충족되었는지 검사해요. 기본적으로 contract_checks 가 활성화되어 있으면 조건이 거짓일 때 언와인드 없이 panic 해요.cond 가 None 이면 후조건 검사를 수행하지 않아요.

pub const fn contract_check_ensures<C, Ret>(cond: Option <C>, ret: Ret) -> Ret where C: Fn ( &Ret ) -> bool + Copy ,

더 알아보기 (Learn more)

Rust 공식 문서