If the prosecuting witness fails without good cause to appear or give evidence on the trial, and defendant is discharged on account of such failure, the magistrate may, in the magistrate’s discretion, tax the costs of the proceeding against such prosecuting witness and render judgment therefor; and if defendant is acquitted, the magistrate shall, if satisfied that the prosecution is malicious or without probable cause, so tax the costs and render judgment therefor.
Iowa. R. Crim. P. 2.69