(a) While Testifying. If, while testifying, a witness uses a writing or object to refresh his memory, an adverse party is entitled to have the writing or object produced at the trial, hearing, or deposition in which the witness is testifying.
(b) Before Testifying. If, before testifying, a witness uses a writing or object to refresh his memory for the purpose of testifying and the court in its discretion determines that the interests of justice so require, an adverse party is entitled to have the writing or object produced, if practicable, at the trial, hearing, or deposition in which the witness is testifying.
(c) Terms and Conditions of Production and Use. A party entitled to have a writing or object produced under this rule is entitled to inspect it, to cross-examine the witness thereon, and to introduce in evidence those portions which relate to the testimony of the witness. If production of the writing or object at the trial, hearing, or deposition is impracticable, the court may order it made available for inspection. If it is claimed that the writing or object contains matters not related to the subject matter of the testimony, the court shall examine the writing or object in camera, excise any portions not so related, and order delivery of the remainder to the party entitled thereto. Any portion withheld over objections shall be preserved and made available to the appellate court in the event of an appeal. If a writing or object is not produced, made available for inspection, or delivered pursuant to order under this rule, the court shall make any order justice requires, but in criminal cases if the prosecution elects not to comply, the order shall be one striking the testimony or, if the court in its discretion determines that the interests of justice so require, declaring a mistrial.