A person charged with a crime or public offense shall not, before conviction, be subject to more restraint than is necessary for his detention to answer the charge.